fix: support both Codex and Nous auth structures in OAuth provider detection (#141)
The isOAuthAuthorized check only looked for Codex's nested
`providers.{key}.tokens.access_token` structure, missing Nous's flat
`providers.nous.access_token`. Now checks both paths so all OAuth
providers are correctly detected and displayed in the provider list.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,14 @@ export async function getAvailable(ctx: any) {
|
||||
const authPath = getActiveAuthPath()
|
||||
if (!existsSync(authPath)) return false
|
||||
const auth = JSON.parse(readFileSync(authPath, 'utf-8'))
|
||||
return !!auth.providers?.[providerKey]?.tokens?.access_token
|
||||
const provider = auth.providers?.[providerKey]
|
||||
if (!provider) return false
|
||||
// Codex: providers.openai-codex.tokens.access_token
|
||||
// Nous: providers.nous.access_token
|
||||
return !!(
|
||||
provider.tokens?.access_token ||
|
||||
provider.access_token
|
||||
)
|
||||
} catch { return false }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user