Class: ShopifyApp::JWT
- Inherits:
-
Object
- Object
- ShopifyApp::JWT
- Defined in:
- lib/shopify_app/session/jwt.rb
Constant Summary collapse
- WARN_EXCEPTIONS =
[ ::JWT::DecodeError, ::JWT::ExpiredSignature, ::JWT::ImmatureSignature, ::JWT::VerificationError, ::ShopifyApp::InvalidAudienceError, ::ShopifyApp::InvalidDestinationError, ::ShopifyApp::MismatchedHostsError, ]
Instance Method Summary collapse
- #expire_at ⇒ Object
-
#initialize(token) ⇒ JWT
constructor
A new instance of JWT.
- #shopify_domain ⇒ Object
- #shopify_user_id ⇒ Object
Constructor Details
#initialize(token) ⇒ JWT
Returns a new instance of JWT.
15 16 17 18 |
# File 'lib/shopify_app/session/jwt.rb', line 15 def initialize(token) @token = token set_payload end |
Instance Method Details
#expire_at ⇒ Object
28 29 30 |
# File 'lib/shopify_app/session/jwt.rb', line 28 def expire_at @payload["exp"].to_i if @payload && @payload["exp"] end |
#shopify_domain ⇒ Object
20 21 22 |
# File 'lib/shopify_app/session/jwt.rb', line 20 def shopify_domain @payload && ShopifyApp::Utils.sanitize_shop_domain(@payload["dest"]) end |
#shopify_user_id ⇒ Object
24 25 26 |
# File 'lib/shopify_app/session/jwt.rb', line 24 def shopify_user_id @payload["sub"].to_i if @payload && @payload["sub"] end |