{"record":{"id":"d8267729cb6491ae","repo":"eyaltoledano/claude-task-master","slug":"no-token","errorCode":"NO_TOKEN","errorMessage":"'Failed to obtain access token from token'","messagePattern":"'Failed to obtain access token from token'","errorType":"exception","errorClass":"AuthenticationError","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/auth/services/session-manager.ts","lineNumber":234,"sourceCode":"\t}\n\n\t// ========== Authentication ==========\n\n\t/**\n\t * Authenticate using a one-time token\n\t * This is useful for CLI authentication in SSH/remote environments\n\t * where browser-based auth is not practical\n\t */\n\tasync authenticateWithCode(token: string): Promise<AuthCredentials> {\n\t\tawait this.waitForInitialization();\n\t\ttry {\n\t\t\tthis.logger.info('Authenticating with one-time token...');\n\n\t\t\t// Verify the token and get session from Supabase\n\t\t\tconst session = await this.supabaseClient.verifyOneTimeCode(token);\n\n\t\t\tif (!session || !session.access_token) {\n\t\t\t\tthrow new AuthenticationError(\n\t\t\t\t\t'Failed to obtain access token from token',\n\t\t\t\t\t'NO_TOKEN'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Get user information\n\t\t\tconst user = await this.supabaseClient.getUser();\n\n\t\t\tif (!user) {\n\t\t\t\tthrow new AuthenticationError(\n\t\t\t\t\t'Failed to get user information',\n\t\t\t\t\t'INVALID_RESPONSE'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Check if MFA is required for this user\n\t\t\tconst mfaCheck = await this.supabaseClient.checkMFARequired();\n","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/auth/services/session-manager.ts#L216-L252","documentation":"AuthenticationError with code NO_TOKEN thrown by SessionManager.authenticateWithCode when verifyOneTimeCode(token) returns null or a session without an access_token. It means Supabase did not accept the one-time token, so no usable session could be established from it.","triggerScenarios":"Calling authenticateWithCode(token) with an expired one-time token, an already-consumed token, a mistyped/truncated token copied from the browser flow, or a token issued by a different Supabase project.","commonSituations":"SSH/remote-headless auth where the one-time token sits in the terminal past its expiry window; pasting the token with trailing whitespace or missing characters; generating a new token but submitting the old one; environment pointing at a different Supabase project than the one that issued the token.","solutions":["Generate a fresh one-time token and use it immediately before it expires","Verify the token is copied completely and without whitespace (trim before passing)","Confirm the Supabase client config points at the same project that issued the token","If the flow keeps failing, use the standard browser-based login instead"],"exampleFix":"// before: reusing an old token\nawait sessionManager.authenticateWithCode(storedToken);\n// after: obtain and validate a fresh token\nconst token = await getFreshOneTimeToken();\nif (!token || token.trim().length < 10) {\n  throw new Error('No valid one-time token available');\n}\nawait sessionManager.authenticateWithCode(token.trim());","handlingStrategy":"validation","validationCode":"// validate the one-time token before submitting it\nconst token = rawToken?.trim();\nif (!token || token.length < 8) {\n  throw new Error('Provide a fresh one-time token from the login URL');\n}","typeGuard":"function isNoTokenError(e: unknown): e is AuthenticationError {\n  return e instanceof AuthenticationError && e.code === 'NO_TOKEN';\n}","tryCatchPattern":"try {\n  await sessionManager.authenticateWithCode(token);\n} catch (e) {\n  if (isNoTokenError(e)) {\n    const fresh = await requestNewOneTimeToken(); // re-run browser flow\n    await sessionManager.authenticateWithCode(fresh.trim());\n  } else throw e;\n}","preventionTips":["Always generate the token immediately before use — they expire quickly","Trim whitespace/newlines when pasting tokens in terminals","Never cache or reuse one-time tokens across runs","Confirm the CLI's Supabase project config matches where the token was issued"],"tags":["auth","one-time-token","supabase","cli"],"backgroundTag":"invalid-auth-token","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}