You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java get jwt token in cookies,but when I parse it is error
11:25:59.697 [main] INFO com.seaurl.gatewaysvr.GatewayServerApplication - error =JWT strings must contain exactly 2 period characters. Found: 4
io.jsonwebtoken.MalformedJwtException: JWT strings must contain exactly 2 period characters. Found: 4
at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:296)
at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:550)
at io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:610)
at io.jsonwebtoken.impl.ImmutableJwtParser.parseClaimsJws(ImmutableJwtParser.java:173)
at com.seaurl.gatewaysvr.GatewayServerApplication.me(GatewayServerApplication.java:31)
at com.seaurl.gatewaysvr.GatewayServerApplication.main(GatewayServerApplication.java:49)
How to reproduce
1、install next.js and next-auth
2、config auth.js
3、send a invoke to backend
4、java parse jwt token
Expected behavior
java can parse next-auth generate token and get user info in it
The text was updated successfully, but these errors were encountered:
zhangwei900808
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Apr 15, 2024
zhangwei900808
changed the title
authjs.session-token send to backend but parse it is error
JWT strings must contain exactly 2 period characters. Found: 4
Apr 15, 2024
The reason you get the kind of error you reported is because Auth.js encrypts JWTs by default (JWE). Auth.js JWTs are not meant for third-party APIs. You need an identity provider that issues access_tokens. That said, you have the jwt.encode and jwt.decode options available to issue a JWT format your backend accepts. This is condiered an advanced option, use it at your own risk:
Environment
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Max
Memory: 2.58 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - /usr/local/bin/node
npm: 10.2.4 - /usr/local/bin/npm
pnpm: 8.6.12 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 123.0.6312.123
Edge: 123.0.2420.97
Safari: 17.4.1
npmPackages:
next: 14.2.1 => 14.1.4
next-auth: 5.0.0-beta.16 => 5.0.0-beta.16
react: ^18 => 18.2.0
Reproduction URL
https://github.com/zhangwei900808/next-auth-redux
Describe the issue
java get jwt token in cookies,but when I parse it is error
How to reproduce
1、install next.js and next-auth
2、config auth.js
3、send a invoke to backend
4、java parse jwt token
Expected behavior
java can parse next-auth generate token and get user info in it
The text was updated successfully, but these errors were encountered: