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

JWT payload is not decoded properly #216

Closed
abhishek97 opened this issue Feb 2, 2018 · 1 comment
Closed

JWT payload is not decoded properly #216

abhishek97 opened this issue Feb 2, 2018 · 1 comment

Comments

@abhishek97
Copy link
Contributor

I was just trying to implement a jwt token auth with refresh token for my app, however, i was getting this error when ember-simple-auth-token tries to decode the jwt received from the server

Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

I looked into the issue for a bit, tracked it down to this line: https://github.com/jpadilla/ember-simple-auth-token/blob/master/addon/authenticators/jwt.js#L284

The thing is we try to do a base64 decode, however as specified in the JWT rfc7519(https://tools.ietf.org/html/rfc7519), the payload is base64url encoded, so window.atob will fail to decode it.

@abhishek97
Copy link
Contributor Author

I seemed to have fixed this, I have also submitted the PR for the same. If someone can look into it please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants