Skip to content

Commit

Permalink
Preserve original JWT decode error message when raising InvalidJwtTok…
Browse files Browse the repository at this point in the history
…enError (Shopify#1207)

Co-authored-by: Nelson <nelsonwittwer@users.noreply.github.com>
  • Loading branch information
2 people authored and garethson committed Dec 1, 2023
1 parent 8b631e6 commit 9169860
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/shopify_api/auth/jwt_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def ==(other)
def decode_token(token, api_secret_key)
JWT.decode(token, api_secret_key, true,
{ exp_leeway: JWT_EXPIRATION_LEEWAY, algorithm: "HS256" })[0]
rescue
raise ShopifyAPI::Errors::InvalidJwtTokenError, "Failed to parse session token '#{token}'"
rescue JWT::DecodeError => err
raise ShopifyAPI::Errors::InvalidJwtTokenError, "Error decoding session token: #{err.message}"
end
end
end
Expand Down

0 comments on commit 9169860

Please sign in to comment.