Class: ShopifyClient::Cookieless::DecodeSessionToken
- Inherits:
-
Object
- Object
- ShopifyClient::Cookieless::DecodeSessionToken
- Defined in:
- lib/shopify-client/cookieless/decode_session_token.rb
Constant Summary collapse
- Error =
Class.new(Error)
Instance Method Summary collapse
-
#call(token) ⇒ String
The *.myshopify.com domain of the authenticated shop.
Instance Method Details
#call(token) ⇒ String
Returns the *.myshopify.com domain of the authenticated shop.
15 16 17 18 19 20 21 22 23 |
# File 'lib/shopify-client/cookieless/decode_session_token.rb', line 15 def call(token) payload, _ = JWT.decode(token, ShopifyClient.config.shared_secret, true, algorithm: 'HS256') raise Error unless valid?(payload) parse_myshopify_domain(payload) rescue JWT::DecodeError raise Error end |