Module: ShopifyApp::TokenExchange
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/shopify_app/controller_concerns/token_exchange.rb
Instance Method Summary collapse
- #activate_shopify_session ⇒ Object
- #current_shopify_domain ⇒ Object
- #current_shopify_session ⇒ Object
Instance Method Details
#activate_shopify_session ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/shopify_app/controller_concerns/token_exchange.rb', line 7 def activate_shopify_session if current_shopify_session.blank? retrieve_session_from_token_exchange end if ShopifyApp.configuration.check_session_expiry_date && current_shopify_session.expired? @current_shopify_session = nil retrieve_session_from_token_exchange end begin ShopifyApp::Logger.debug("Activating Shopify session") ShopifyAPI::Context.activate_session(current_shopify_session) yield ensure ShopifyApp::Logger.debug("Deactivating session") ShopifyAPI::Context.deactivate_session end end |
#current_shopify_domain ⇒ Object
40 41 42 43 44 |
# File 'lib/shopify_app/controller_concerns/token_exchange.rb', line 40 def current_shopify_domain return if params[:shop].blank? ShopifyApp::Utils.sanitize_shop_domain(params[:shop]) end |
#current_shopify_session ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/shopify_app/controller_concerns/token_exchange.rb', line 27 def current_shopify_session @current_shopify_session ||= begin session_id = ShopifyAPI::Utils::SessionUtils.current_session_id( request.headers["HTTP_AUTHORIZATION"], nil, online_token_configured?, ) return nil unless session_id ShopifyApp::SessionRepository.load_session(session_id) end end |