question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JWTs must have three components

See original GitHub issue

Description 🐜

Hi when I’m trying to pull the jwt accestoken I have error:

JWTs must have three components

I’ve ussed snippet from documentation.

I’m using Google auth with firebase.

Is this a bug in your own project?

Yes

How to reproduce ☕️

import jwt from 'next-auth/jwt'

const secret = process.env.GOOGLE_SECRET

export default async (req, res) => {
  const token = await jwt.getToken({ req, secret })
  if (token) {
    // Signed in
    console.log('JSON Web Token', JSON.stringify(token, null, 2))
  } else {
    // Not Signed in
    res.status(401)
  }
  res.end()
}

response:

JWTMalformed: JWTs must have three components
.....
 {
  code: 'ERR_JWT_MALFORMED'
}

Screenshots / Logs 📽

No response

Environment 🖥

System: OS: macOS 11.4 CPU: (8) arm64 Apple M1 Memory: 106.19 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node npm: 6.14.13 - ~/.nvm/versions/node/v14.17.3/bin/npm Browsers: Brave Browser: 91.1.26.74 Chrome: 92.0.4515.131 Safari: 14.1.1 npmPackages: next: 11.0.1 => 11.0.1 next-auth: ^3.27.3 => 3.27.3 react: 17.0.2 => 17.0.2

Contributing 🙌🏽

No, I am afraid I cannot help regarding this

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
machmielewskicommented, Aug 17, 2021

There are dummy secrets for reproduce purpose 😃

On Tue, 17 Aug 2021, 12:48 Balázs Orbán, @.***> wrote:

⚠ You should not publish your secrets publicly! You MUST immediately change those secrets, because you probably already have been compromised. I was only thinking of your code to be reproduced

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nextauthjs/next-auth/issues/2538#issuecomment-900190635, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQI4ZCGU36H2TU4LASDENTTT5I5ALANCNFSM5CHXH2OA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

0reactions
balazsorban44commented, Aug 17, 2021

Not wasting my time! 😉 If you find a way to reliably reproduce this issue, I will be happy to look at it again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does 'JWT must have 3 parts' mean? - Auth0 Community
I can authenticate, I receive the 'authResult' object but clearly 'access_token' is invalid as a bearer token. I have gotten my api to...
Read more >
Angular2 JWT Authentication - JWTs must come in 3 parts?
This site can tell you if it's a valid JWT and can decode its contents, so you can prove that it correct. Save...
Read more >
A Beginner's Guide to JWTs - Okta Developer
There are three types of claims: "registered," "public," and "private." You can find the list of registered and public claims in the official ......
Read more >
JSON Web Token (JWT) - IBM
Figure 1 shows that a JWT consists of three parts: a header, payload, and signature. Header: The header typically consists of two parts:...
Read more >
JWT: The Complete Guide to JSON Web Tokens
Having a detailed overview of JWTs is essential for: ... A JWT is made of 3 parts: the Header, the Payload and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found