diff --git a/README.md b/README.md index b6d9299e4..3fffe670f 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ authenticated API access. ShopifyApp.configure do |config| #..... config.embedded_app = true - config.unstable_new_embedded_auth_strategy = true + config.new_embedded_auth_strategy = true # If your app is configured to use online sessions, you can enable session expiry date check so a new access token # is fetched automatically when the session expires. diff --git a/lib/generators/shopify_app/install/templates/shopify_app.rb.tt b/lib/generators/shopify_app/install/templates/shopify_app.rb.tt index a542dac6c..1bd5c26a9 100644 --- a/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +++ b/lib/generators/shopify_app/install/templates/shopify_app.rb.tt @@ -4,7 +4,7 @@ ShopifyApp.configure do |config| config.scope = "<%= @scope %>" # Consult this page for more scope options: # https://help.shopify.com/en/api/getting-started/authentication/oauth/scopes config.embedded_app = <%= embedded_app? %> - config.unstable_new_embedded_auth_strategy = <%= embedded_app? %> + config.new_embedded_auth_strategy = <%= embedded_app? %> config.after_authenticate_job = false config.api_version = "<%= @api_version %>" diff --git a/lib/shopify_app/configuration.rb b/lib/shopify_app/configuration.rb index 2c6a727d3..04c9be08e 100644 --- a/lib/shopify_app/configuration.rb +++ b/lib/shopify_app/configuration.rb @@ -49,7 +49,7 @@ class Configuration attr_accessor :billing # Enables new authorization flow using token exchange - attr_accessor :unstable_new_embedded_auth_strategy + attr_accessor :new_embedded_auth_strategy def initialize @root_url = "/" @@ -129,7 +129,7 @@ def user_access_scopes end def use_new_embedded_auth_strategy? - unstable_new_embedded_auth_strategy && embedded_app? + new_embedded_auth_strategy && embedded_app? end def online_token_configured? diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb index 530d31624..e80b1939d 100644 --- a/test/controllers/sessions_controller_test.rb +++ b/test/controllers/sessions_controller_test.rb @@ -16,7 +16,7 @@ class SessionsControllerTest < ActionController::TestCase ShopifyApp.configuration.api_version = ShopifyAPI::LATEST_SUPPORTED_ADMIN_VERSION ShopifyApp::SessionRepository.shop_storage = ShopifyApp::InMemoryShopSessionStore ShopifyApp::SessionRepository.user_storage = nil - ShopifyApp.configuration.unstable_new_embedded_auth_strategy = false + ShopifyApp.configuration.new_embedded_auth_strategy = false ShopifyApp.configuration.api_key = APP_API_KEY ShopifyAppConfigurer.setup_context # need to reset context after config changes @@ -394,7 +394,7 @@ class SessionsControllerTest < ActionController::TestCase "https://admin.shopify.com/store/my-shop", ].each do |good_url| test "#create redirects to Shopify managed install path instead if use_new_embedded_auth_strategy is enabled - #{good_url}" do - ShopifyApp.configuration.unstable_new_embedded_auth_strategy = true + ShopifyApp.configuration.new_embedded_auth_strategy = true post :create, params: { shop: good_url } diff --git a/test/dummy/config/initializers/shopify_app.rb b/test/dummy/config/initializers/shopify_app.rb index 2c574d170..f21a2f97b 100644 --- a/test/dummy/config/initializers/shopify_app.rb +++ b/test/dummy/config/initializers/shopify_app.rb @@ -21,7 +21,7 @@ def self.call config.after_authenticate_job = false config.reauth_on_access_scope_changes = true config.root_url = "/" - config.unstable_new_embedded_auth_strategy = false + config.new_embedded_auth_strategy = false config.check_session_expiry_date = false config.custom_post_authenticate_tasks = nil end diff --git a/test/generators/install_generator_test.rb b/test/generators/install_generator_test.rb index be326b66b..c2224ccc3 100644 --- a/test/generators/install_generator_test.rb +++ b/test/generators/install_generator_test.rb @@ -24,7 +24,7 @@ class InstallGeneratorTest < Rails::Generators::TestCase assert_match "config.secret = ENV.fetch('SHOPIFY_API_SECRET', '')", shopify_app assert_match 'config.scope = "read_products"', shopify_app assert_match "config.embedded_app = true", shopify_app - assert_match "config.unstable_new_embedded_auth_strategy = true", shopify_app + assert_match "config.new_embedded_auth_strategy = true", shopify_app assert_match "config.api_version = \"#{ShopifyAPI::LATEST_SUPPORTED_ADMIN_VERSION}\"", shopify_app assert_match "config.after_authenticate_job = false", shopify_app @@ -66,7 +66,7 @@ class InstallGeneratorTest < Rails::Generators::TestCase assert_match "config.secret = ENV.fetch('SHOPIFY_API_SECRET', '')", shopify_app assert_match 'config.scope = "read_orders write_products"', shopify_app assert_match "config.embedded_app = true", shopify_app - assert_match "config.unstable_new_embedded_auth_strategy = true", shopify_app + assert_match "config.new_embedded_auth_strategy = true", shopify_app assert_match 'config.api_version = "unstable"', shopify_app assert_match "config.shop_session_repository = 'Shop'", shopify_app end @@ -80,7 +80,7 @@ class InstallGeneratorTest < Rails::Generators::TestCase assert_match "config.secret = ENV.fetch('SHOPIFY_API_SECRET', '')", shopify_app assert_match 'config.scope = "read_orders write_products"', shopify_app assert_match "config.embedded_app = true", shopify_app - assert_match "config.unstable_new_embedded_auth_strategy = true", shopify_app + assert_match "config.new_embedded_auth_strategy = true", shopify_app assert_match "config.shop_session_repository = 'Shop'", shopify_app end end @@ -89,7 +89,7 @@ class InstallGeneratorTest < Rails::Generators::TestCase run_generator ["--embedded", "false"] assert_file "config/initializers/shopify_app.rb" do |shopify_app| assert_match "config.embedded_app = false", shopify_app - assert_match "config.unstable_new_embedded_auth_strategy = false", shopify_app + assert_match "config.new_embedded_auth_strategy = false", shopify_app end end diff --git a/test/shopify_app/configuration_test.rb b/test/shopify_app/configuration_test.rb index dfa8ec3cb..b4036eb85 100644 --- a/test/shopify_app/configuration_test.rb +++ b/test/shopify_app/configuration_test.rb @@ -241,27 +241,27 @@ class ConfigurationTest < ActiveSupport::TestCase assert_equal "Invalid user access scopes strategy - expected a string", error.message end - test "#use_new_embedded_auth_strategy? is true when unstable_new_embedded_auth_strategy is on for embedded apps" do + test "#use_new_embedded_auth_strategy? is true when new_embedded_auth_strategy is on for embedded apps" do ShopifyApp.configure do |config| config.embedded_app = true - config.unstable_new_embedded_auth_strategy = true + config.new_embedded_auth_strategy = true end assert ShopifyApp.configuration.use_new_embedded_auth_strategy? end - test "#use_new_embedded_auth_strategy? is false for non-embedded apps even if unstable_new_embedded_auth_strategy is configured" do + test "#use_new_embedded_auth_strategy? is false for non-embedded apps even if new_embedded_auth_strategy is configured" do ShopifyApp.configure do |config| config.embedded_app = false - config.unstable_new_embedded_auth_strategy = true + config.new_embedded_auth_strategy = true end refute ShopifyApp.configuration.use_new_embedded_auth_strategy? end - test "#use_new_embedded_auth_strategy? is false when unstable_new_embedded_auth_strategy is off" do + test "#use_new_embedded_auth_strategy? is false when new_embedded_auth_strategy is off" do ShopifyApp.configure do |config| - config.unstable_new_embedded_auth_strategy = false + config.new_embedded_auth_strategy = false end refute ShopifyApp.configuration.use_new_embedded_auth_strategy?