OAuth Failing: "error: OPError: invalid_token (The access token is invalid)"

Hey there, I have been running a Coinbase application for the last 6 months. I’m using nextjs + next-auth + vercel to do my single sign-on via Coinbase.

In the last few weeks I have stopped being able to authenticate via coinbase. In the logs I’m seeing

[next-auth][error][OAUTH_CALLBACK_ERROR] 
https://next-auth.js.org/errors#oauth_callback_error invalid_token (The access token is invalid) {
  error: OPError: invalid_token (The access token is invalid)
      at throwAuthenticateErrors (/Users/kzmv/dev/next-auth-coin-cli/node_modules/openid-client/lib/helpers/process_response.js:11:11)
      at processResponse (/Users/kzmv/dev/next-auth-coin-cli/node_modules/openid-client/lib/helpers/process_response.js:34:7)
      at Client.userinfo (/Users/kzmv/dev/next-auth-coin-cli/node_modules/openid-client/lib/client.js:1237:18)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async oAuthCallback (/Users/kzmv/dev/next-auth-coin-cli/node_modules/next-auth/core/lib/oauth/callback.js:131:17)
      at async Object.callback (/Users/kzmv/dev/next-auth-coin-cli/node_modules/next-auth/core/routes/callback.js:52:11)
      at async AuthHandler (/Users/kzmv/dev/next-auth-coin-cli/node_modules/next-auth/core/index.js:208:28)
      at async NextAuthApiHandler (/Users/kzmv/dev/next-auth-coin-cli/node_modules/next-auth/next/index.js:22:19)
      at async NextAuth._args$ (/Users/kzmv/dev/next-auth-coin-cli/node_modules/next-auth/next/index.js:108:14) {
    name: 'OAuthCallbackError',
    code: undefined
  },
  providerId: 'coinbase',
  message: 'invalid_token (The access token is invalid)'
}

I have tried:

  • creating and configuring a new oAuth application.
  • I get the same error via my vercel deployed nextjs and via localhost.
  • Changed NEXT_AUTH secrets

Has there been any undisclosed change that maybe the next-auth hasn’t picked up in the last month? I can’t make sense as to why it stopped working suddenly.