Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in logic for decoding anything other than MapClaims #57

Open
lggomez opened this issue Aug 3, 2021 · 2 comments
Open

Bug in logic for decoding anything other than MapClaims #57

lggomez opened this issue Aug 3, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation jwt-go: legacy

Comments

@lggomez
Copy link
Member

lggomez commented Aug 3, 2021

Migrated from dgrijalva/jwt-go#458

smcallis commented on Mar 17

jwt-go/parser.go

Line 131 in dc14462
err = dec.Decode(&claims)

Since this function takes claims as Claims, if you pass anything other than MapClaims{}, you'll get an unmarshalling error:
Error verifying token: json: cannot unmarshal object into Go value of type jwt.Claims

@lggomez lggomez added documentation Improvements or additions to documentation jwt-go: legacy labels Aug 3, 2021
@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

niclasgeiger commented on May 21

ah, if you use &MapClaims{} instead of MapClaims{} it will work. See https://stackoverflow.com/questions/50564341/pointer-to-an-interface-vs-interface-holding-a-pointer-when-unmarshaling-json for more explanations

@JK-97
Copy link

JK-97 commented Jul 18, 2023

when fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation jwt-go: legacy
Projects
None yet
Development

No branches or pull requests

2 participants