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()
|
const authPath = getActiveAuthPath()
|
||||||
if (!existsSync(authPath)) return false
|
if (!existsSync(authPath)) return false
|
||||||
const auth = JSON.parse(readFileSync(authPath, 'utf-8'))
|
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 }
|
} catch { return false }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const PROVIDER_ENV_MAP: Record<string, { api_key_env: string; base_url_en
|
|||||||
'opencode-go': { api_key_env: 'OPENCODE_API_KEY', base_url_env: '' },
|
'opencode-go': { api_key_env: 'OPENCODE_API_KEY', base_url_env: '' },
|
||||||
huggingface: { api_key_env: 'HF_TOKEN', base_url_env: '' },
|
huggingface: { api_key_env: 'HF_TOKEN', base_url_env: '' },
|
||||||
arcee: { api_key_env: 'ARCEE_API_KEY', base_url_env: '' },
|
arcee: { api_key_env: 'ARCEE_API_KEY', base_url_env: '' },
|
||||||
stepfun: { api_key_env: 'STEPFUN_API_KEY', base_url_env: 'STEPFUN_BASE_URL' },
|
stepfun: { api_key_env: 'STEPFUN_API_KEY', base_url_env: '' },
|
||||||
nous: { api_key_env: '', base_url_env: '' },
|
nous: { api_key_env: '', base_url_env: '' },
|
||||||
'openai-codex': { api_key_env: '', base_url_env: '' },
|
'openai-codex': { api_key_env: '', base_url_env: '' },
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user