Skip to content

Commit 0eb2306

Browse files
use JWT_LEEWAY constant for JWT leeway param
1 parent 9c481e5 commit 0eb2306

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/shopify_api/auth/jwt_payload.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module Auth
66
class JwtPayload
77
extend T::Sig
88

9-
JWT_EXPIRATION_LEEWAY = 10
9+
JWT_LEEWAY = 10
10+
JWT_EXPIRATION_LEEWAY = JWT_LEEWAY
1011

1112
sig { returns(String) }
1213
attr_reader :iss, :dest, :aud, :sub, :jti, :sid
@@ -73,7 +74,7 @@ def ==(other)
7374

7475
sig { params(token: String, api_secret_key: String).returns(T::Hash[String, T.untyped]) }
7576
def decode_token(token, api_secret_key)
76-
JWT.decode(token, api_secret_key, true, leeway: JWT_EXPIRATION_LEEWAY, algorithm: "HS256")[0]
77+
JWT.decode(token, api_secret_key, true, leeway: JWT_LEEWAY, algorithm: "HS256")[0]
7778
rescue JWT::DecodeError => err
7879
raise ShopifyAPI::Errors::InvalidJwtTokenError, "Error decoding session token: #{err.message}"
7980
end

0 commit comments

Comments
 (0)