{"record":{"id":"876537528b487185","repo":"Kong/insomnia","slug":"authorization-code-not-found","errorCode":null,"errorMessage":"Authorization code not found","messagePattern":"Authorization code not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/main/mcp/oauth-client-provider.ts","lineNumber":191,"sourceCode":"    const { relayUrl, decryptOAuthResult } = encryptOAuthUrl(authorizationUrl.toString());\n    BrowserWindow.getAllWindows().forEach(window => {\n      window.webContents.send('show-oauth-authorization-modal', relayUrl);\n    });\n    const shouldOpenDefaultBrowser =\n      'grantType' in this.authentication && this.authentication.grantType === 'mcp_auth_flow'\n        ? !this.authentication.launchBrowserManually\n        : true;\n    const redirectedResult = await authorizeUserInDefaultBrowser({\n      url: relayUrl,\n      openDefaultBrowser: shouldOpenDefaultBrowser,\n    });\n    const redirectedTo = decryptOAuthResult(redirectedResult);\n    const redirectParams = Object.fromEntries(new URL(redirectedTo).searchParams);\n    const { code: authorizationCode, error, error_description, error_uri } = redirectParams;\n    if (error) {\n      throw new Error(JSON.stringify({ error, error_description, error_uri }));\n    } else if (!authorizationCode) {\n      throw new Error('Authorization code not found');\n    }\n    await this._redirectEndListener?.(authorizationCode);\n  }\n  onRedirectEnd(listener: (authorizationCode: string) => void) {\n    this._redirectEndListener = listener;\n    return () => {\n      this._redirectEndListener = null;\n    };\n  }\n  async saveCodeVerifier(codeVerifier: string) {\n    this._codeVerifier = codeVerifier;\n  }\n  async codeVerifier() {\n    if (!this._codeVerifier) {\n      throw new Error('Code verifier not set');\n    }\n    return this._codeVerifier;\n  }","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/main/mcp/oauth-client-provider.ts#L173-L209","documentation":"OAuth result parsing in the MCP provider's redirectToAuthorization: the redirect completed without OAuth error parameters but also without an authorization code, so there is nothing to exchange for tokens. Indicates a malformed provider redirect configuration.","triggerScenarios":"Thrown at packages/insomnia/src/main/mcp/oauth-client-provider.ts:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the authorization flow","Check the authorization server returned a code in the redirect","Verify redirect URI matches the registered one"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","contentChangedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}