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

Sample code given in readme returns an error. #110

Open
bibinjacobpulickal opened this issue Jun 29, 2018 · 0 comments
Open

Sample code given in readme returns an error. #110

bibinjacobpulickal opened this issue Jun 29, 2018 · 0 comments

Comments

@bibinjacobpulickal
Copy link

This is the sample code given for decoding a jwt gives an error "Failed to decode JWT: Unsupported algorithm or incorrect key", which is really undesirable from a developers perspective. I also, tried decoding my string that didn't work either
do { let claims: ClaimSet = try JWT.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.2_8pWJfyPup0YwOXK7g9Dn0cF1E3pdn299t4hSeJy5w", algorithm: .hs256("secret".data(using: .utf8)!)) print(claims) } catch { print("Failed to decode JWT: \(error)") }
This was my string:
"eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NhcGkuZGJzLmNvbSIsImlhdCI6MTUzMDI1MzE0MzIyOSwiZXhwIjoxNTMwMjU2NzQzMjI5LCJzdWIiOiJTVmN3TXpZPSIsInB0eXR5cGUiOjEsImNsbmlkIjoiY2xpZW50SWQyIiwiY2xudHlwZSI6IjIiLCJhY2Nlc3MiOiIxRkEiLCJzY29wZSI6IjJGQS1TTVMiLCJhdWQiOiJodHRwczovL2NhcGkuZGJzLmNvbS9hY2Nlc3MiLCJqdGkiOiI1OTc1OTE1ODk4MjQ1MDYwMjQ2IiwiY2luIjoiVXpFeE5USXlOREZHIn0.PnCyow4gk3-i5odLy81eJ_G-uU_DQAmkvWAIHpRraBQ"
screen shot 2018-06-29 at 13 08 42

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

1 participant