openai/codex · error · anyhow::Error
OAuth provider did not return credentials
Error message
OAuth provider did not return credentials
What it means
Generic guard in the OAuth login flow: the provider exchange and callback succeeded (handle_callback_with_issuer returned Ok), but get_credentials() returned no credential pair, leaving the client without tokens to use the server. Points at the OAuth provider/authorization server not issuing tokens rather than a local parse failure.
Solutions
- Retry the OAuth login; a transient provider hiccup may drop the token issuance step
- Check the provider's token endpoint configuration (client_id, scopes, redirect URI) so it actually returns access/refresh tokens
- Inspect provider logs for the failed token exchange
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:657 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/968c98d9978f4576.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:657
state: csrf_state,
issuer,
} = match callback {
CallbackResult::Success(callback) => callback,
CallbackResult::Error(error) => return Err(anyhow!(error)),
};
self.oauth_state
.handle_callback_with_issuer(&code, &csrf_state, issuer.as_deref())
.await
.context("failed to handle OAuth callback")?;
let (client_id, credentials_opt) = self
.oauth_state
.get_credentials()
.await
.context("failed to retrieve OAuth credentials")?;
let credentials = credentials_opt
.ok_or_else(|| anyhow!("OAuth provider did not return credentials"))?;
let expires_at = compute_expires_at_millis(&credentials);
let stored = StoredOAuthTokens {
server_name: self.server_name.clone(),
url: self.server_url.clone(),
issuer: self.authorization_server_issuer.clone(),
client_id,
token_response: WrappedOAuthTokenResponse(credentials),
expires_at,
};
save_oauth_tokens(
&self.server_name,
&stored,
self.store_mode,
self.keyring_backend_kind,
)?;
Ok(())View on GitHub (pinned to 339751715c)