Sha256: 27cc33b3646173b3f8435e205925b51230d95d013c0e0522ee27d2032fe9e570
Contents?: true
Size: 1.09 KB
Versions: 8
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module ShopifyApp module ShopAccessScopesVerification extend ActiveSupport::Concern include ShopifyApp::RedirectForEmbedded included do # Embedded auth strategy uses Shopify managed install to ensure latest access scopes, # This will be handled automatically through token exchange unless ShopifyApp.configuration.use_new_embedded_auth_strategy? before_action :login_on_scope_changes end end protected def login_on_scope_changes if scopes_mismatch? if embedded_param? redirect_for_embedded else redirect_to(shop_login) end end end private def scopes_mismatch? ShopifyApp.configuration.shop_access_scopes_strategy.update_access_scopes?(current_shopify_domain) end def current_shopify_domain return if params[:shop].blank? ShopifyApp::Utils.sanitize_shop_domain(params[:shop]) end def shop_login ShopifyApp::Utils.shop_login_url(shop: params[:shop], host: params[:host], return_to: request.fullpath) end end end
Version data entries
8 entries across 8 versions & 1 rubygems