MCPcopy
hub / github.com/MiniMax-AI/cli / runOAuthLogin

Function runOAuthLogin

src/auth/setup.ts:90–101  ·  view source on GitHub ↗
(region: Region)

Source from the content-addressed store, hash-verified

88}
89
90export async function runOAuthLogin(region: Region): Promise<void> {
91 const creds = await deviceCodeLogin(region);
92 // OAuth and api_key are mutually exclusive — drop any stale api_key
93 // so `mmx auth status` and the resolver see a single source of truth.
94 const existing = readConfigFile() as Record<string, unknown>;
95 delete existing.api_key;
96 existing.oauth = creds;
97 existing.region = region;
98 await writeConfigFile(existing);
99 process.stderr.write('Logged in successfully.\n');
100 process.stderr.write('Credentials saved to ~/.mmx/config.json\n');
101}
102
103async function persistApiKey(config: Config, key: string): Promise<void> {
104 const data = { ...(readConfigFile() as Record<string, unknown>), api_key: key };

Callers 2

completeOAuthLoginFunction · 0.90
ensureAuthFunction · 0.85

Calls 3

deviceCodeLoginFunction · 0.90
readConfigFileFunction · 0.90
writeConfigFileFunction · 0.90

Tested by

no test coverage detected