Skip to content

fix(auth): use region-specific OAuth endpoints for cn region (#85)#88

Closed
raylanlin wants to merge 1 commit intoMiniMax-AI:mainfrom
raylanlin:fix/oauth-region-routing
Closed

fix(auth): use region-specific OAuth endpoints for cn region (#85)#88
raylanlin wants to merge 1 commit intoMiniMax-AI:mainfrom
raylanlin:fix/oauth-region-routing

Conversation

@raylanlin
Copy link
Copy Markdown
Contributor

Summary

Fixes #85 — OAuth login always used the international platform URL (platform.minimax.io) regardless of the user's configured region, causing 404 errors for cn-region users.

Changes

  • src/auth/oauth.ts: Replaced hardcoded DEFAULT_OAUTH_CONFIG with getOAuthConfig(region) that selects the correct OAuth endpoints for global vs cn
  • src/auth/refresh.ts: Token refresh URL is now region-specific
  • src/auth/types.ts: Added region field to CredentialFile so the correct refresh URL can be used later
  • src/commands/auth/login.ts: Passes config.region to OAuth flows and persists region in saved credentials

How it works

Region authorizationUrl tokenUrl
global platform.minimax.io/oauth/authorize api.minimax.io/v1/oauth/token
cn platform.minimaxi.com/oauth/authorize api.minimaxi.com/v1/oauth/token

…-AI#85)

OAuth login always used the international platform URLs
(platform.minimax.io) regardless of the user's configured region.
This causes 404 errors for cn-region users during OAuth login.

Changes:
- src/auth/oauth.ts: Replace hardcoded DEFAULT_OAUTH_CONFIG with
  getOAuthConfig(region) that selects the correct endpoints for
  global vs cn
- src/auth/refresh.ts: Use region-specific token refresh URL
- src/auth/types.ts: Store region in CredentialFile for token refresh
- src/commands/auth/login.ts: Pass region to OAuth flow and persist
  region in saved credentials
@raylanlin
Copy link
Copy Markdown
Contributor Author

Closing — OAuth device code endpoints are currently returning 404 on both regions due to ongoing account merging on MiniMax's side. Will revisit once OAuth infrastructure stabilizes.

@raylanlin raylanlin closed this Apr 11, 2026
@raylanlin raylanlin deleted the fix/oauth-region-routing branch April 11, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] OAuth login uses international platform URL even when region is set to cn

1 participant