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
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"
The text was updated successfully, but these errors were encountered:
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"
The text was updated successfully, but these errors were encountered: