nextauthjs / nextauthjs/next-auth

OAuthCallbackError on Dropbox

Open
#8,098 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

providers triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Provider type

Dropbox

Environment

System:
OS: Windows 10 10.0.19044
CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
Memory: 5.36 GB / 15.93 GB
Binaries:
Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 9.6.5 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.82)
Internet Explorer: 11.0.19041.1566

Reproduction URL

Private

Describe the issue

Whenever I try to log in with the Dropbox provider I get this error:

[next-auth][error][OAUTH_CALLBACK_ERROR] 
https://next-auth.js.org/errors#oauth_callback_error expected 200 OK, got: 404 Not Found {
  error: OPError: expected 200 OK, got: 404 Not Found
      at processResponse (webpack-internal:///(sc_server)/./node_modules/openid-client/lib/helpers/process_response.js:37:15)
      at Client.userinfo (webpack-internal:///(sc_server)/./node_modules/openid-client/lib/client.js:1110:22)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async oAuthCallback (webpack-internal:///(sc_server)/./node_modules/next-auth/core/lib/oauth/callback.js:136:23)
      at async Object.callback (webpack-internal:///(sc_server)/./node_modules/next-auth/core/routes/callback.js:18:79)
      at async AuthHandler (webpack-internal:///(sc_server)/./node_modules/next-auth/core/index.js:202:38)
      at async NextAuthRouteHandler (webpack-internal:///(sc_server)/./node_modules/next-auth/next/index.js:49:30)
      at async NextAuth._args$ (webpack-internal:///(sc_server)/./node_modules/next-auth/next/index.js:83:24)
      at async eval (webpack-internal:///(sc_server)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:253:37) {
    name: 'OAuthCallbackError',
    code: undefined
  },
  providerId: 'dropbox',
  message: 'expected 200 OK, got: 404 Not Found'
}

The issue might be on the token URI https://api.dropboxapi.com/oauth2/token which if access with GET method it returns a 404, but with POST it works fine

How to reproduce

Use dropbox provider

Expected behavior

There should not be an error

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OAuth callback path shown in next-auth/core/lib/oauth/callback.js and the Dropbox provider configuration, then inspect how openid-client requests the token and userinfo endpoints. Reproduce the Dropbox login and verify that the callback completes without the 404 OAuthCallbackError.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, nodejs, typescript
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.