nextauthjs / nextauthjs/next-auth

Coinbase provider - CallbackRouteError

Open
#12,433 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Provider type

Coinbase

Environment
 System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 9.29 GB / 15.56 GB
  Binaries:
    Node: 22.12.0 - C:\Program Files\nodejs\node.EXE      
    Yarn: 1.22.22 - ~\.bun\bin\yarn.EXE
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    bun: 1.1.42 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (131.0.2903.99)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @auth/prisma-adapter: ^2.7.4 => 2.7.4
    next: 15.1.2 => 15.1.2
    next-auth: ^5.0.0-beta.25 => 5.0.0-beta.25
    react: ^19.0.0 => 19.0.0
Reproduction URL

https://github.com/wilkinnovo/auth-example

Describe the issue

Coinbase app API may have changed. It is not sending the correct content type in the response when sending request to https://api.coinbase.com/v2/user . Content-Type appears to be: 'content-type': 'application/protobuf'. making the call to .json() give error as follows:  

[auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror
[auth][cause]: SyntaxError: Unexpected token '�', "

$a851b4"... is not valid JSON
at JSON.parse ()
at parseJSONFromBytes (node:internal/deps/undici/undici:5731:19)
at successSteps (node:internal/deps/undici/undici:5712:27)
at fullyReadBody (node:internal/deps/undici/undici:4609:9)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async consumeBody (node:internal/deps/undici/undici:5721:7)
.....

error_auth5

How to reproduce

Clone the repo and run the application with the credentials from coinbase and prisma DB url string.

Expected behavior

Respond with JSON data as follows:

curl https://api.coinbase.com/v2/user /
-H 'Authorization: Bearer 6915ab99857fec1e6f2f6c078583756d0c09d7207750baea28dfbc3d4b0f2cb80'

Example response:

{
"data": {
"id": "9da7a204-544e-5fd1-9a12-61176c5d4cd8",
"name": "User One",
"username": "user1",
"profile_location": null,
"profile_bio": null,
"profile_url": "https://coinbase.com/user1",
"avatar_url": "https://images.coinbase.com/avatar?h=vR%2FY8igBoPwuwGren5JMwvDNGpURAY%2F0nRIOgH%2FY2Qh%2BQ6nomR3qusA%2Bh6o2%0Af9rH&s=128",
"resource": "user",
"resource_path": "/v2/user"
}
}

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 by cloning the linked auth-example repository and reproducing the Coinbase callback with the listed credentials and environment. Inspect the request to https://api.coinbase.com/v2/user and its response content type, then determine whether the callback can receive the expected JSON or whether the behavior is external to the provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, node.js, react, typescript
Domain
api, authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.