{"record":{"id":"ed140b513481fedc","repo":"transloadit/uppy","slug":"could-not-load-authentication-data-required-for-th","errorCode":null,"errorMessage":"Could not load authentication data required for third-party login. Please try again later.","messagePattern":"Could not load authentication data required for third-party login\\. Please try again later\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@uppy/core/src/companion-client/Provider.ts","lineNumber":126,"sourceCode":"  #getPlugin() {\n    const plugin = this.uppy.getPlugin(this.pluginId) as UnknownProviderPlugin<\n      M,\n      B\n    >\n    if (plugin == null) throw new Error('Plugin was nullish')\n    return plugin\n  }\n\n  /**\n   * Ensure we have a preauth token if necessary. Attempts to fetch one if we don't,\n   * or rejects if loading one fails.\n   */\n  async ensurePreAuth(): Promise<void> {\n    if (this.companionKeysParams && !this.preAuthToken) {\n      await this.fetchPreAuthToken()\n\n      if (!this.preAuthToken) {\n        throw new Error(\n          'Could not load authentication data required for third-party login. Please try again later.',\n        )\n      }\n    }\n  }\n\n  authQuery(data: unknown): Record<string, string> {\n    return {}\n  }\n\n  authUrl({\n    authFormData,\n    query,\n    authCallbackToken,\n  }: {\n    authFormData: unknown\n    query: Record<string, string>\n    authCallbackToken?: string | undefined","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/core/src/companion-client/Provider.ts#L108-L144","documentation":"Thrown by Provider.ensurePreAuth when the plugin is configured with companionKeysParams (i.e. it must fetch a short-lived pre-auth token from Companion before OAuth) but fetchPreAuthToken() failed to obtain one. It aborts the third-party login flow early instead of proceeding with an invalid session. Typically the underlying cause is a network failure or a Companion server error, which surfaces in the console as a separate logged error.","triggerScenarios":"Calling provider.loginOAuth() (e.g. clicking 'Sign in with Google Drive' in the Dashboard) while the plugin was instantiated with companionKeysParams, and the POST /pre-auth/: Companion request either fails or returns no token. ensurePreAuth then sees this.preAuthToken still falsy and throws.","commonSituations":"Companion is down, misconfigured, or the client points to a wrong companionUrl; a reverse proxy/CORS rule blocks the pre-auth request; the provider credentials on Companion are invalid so it refuses to mint a token; transient network hiccup during login.","solutions":["Check the browser network tab / Companion logs for the failed pre-auth request and fix the Companion-side issue (credentials, provider secret, companionUrl)","Verify the companionUrl passed to the plugin is reachable and correctly proxied (HTTPS, CORS headers)","Retry login after fixing connectivity — ensurePreAuth runs per login attempt","If you do not need key-based Companion auth, remove companionKeysParams from the plugin options so no pre-auth token is required"],"exampleFix":"// before\nnew GoogleDrive(uppy, {\n  companionUrl: 'http://localhost:3020', // wrong/down Companion\n  companionKeysParams: { key: '...' },\n})\n\n// after\nnew GoogleDrive(uppy, {\n  companionUrl: 'https://companion.example.com', // verified healthy Companion\n  companionKeysParams: { key: '...' },\n})","handlingStrategy":"try-catch","validationCode":"// before login, probe Companion health\nawait fetch(`${companionUrl}/`, { method: 'HEAD' }).catch(() => {\n  throw new Error('Companion unreachable')\n})","typeGuard":"null","tryCatchPattern":"try {\n  await provider.loginOAuth()\n} catch (err) {\n  if (err.message.includes('Could not load authentication data')) {\n    uppy.info('Login temporarily unavailable, please retry.', 'error', 5000)\n  }\n}","preventionTips":["Health-check companionUrl before enabling provider buttons","Monitor Companion availability and alert on downtime","Use HTTPS with proper CORS so the pre-auth POST never fails silently"],"tags":["companion","oauth","pre-auth","network","provider"],"backgroundTag":"oauth-token-request-failed","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}