shopify_app 21.0.0 → 22.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/ISSUE_TEMPLATE/ENHANCEMENT.md +9 -0
- data/.github/ISSUE_TEMPLATE/bug-report.md +30 -47
- data/.github/ISSUE_TEMPLATE/feature-request.md +5 -29
- data/.github/workflows/build.yml +11 -12
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/remove-labels-on-activity.yml +1 -1
- data/.github/workflows/rubocop.yml +2 -3
- data/.nvmrc +1 -1
- data/.rubocop.yml +2 -1
- data/.ruby-version +1 -1
- data/.spin/rails/prepare-application +8 -0
- data/CHANGELOG.md +173 -7
- data/CODE_OF_CONDUCT.md +46 -0
- data/CONTRIBUTING.md +16 -6
- data/Gemfile +1 -0
- data/Gemfile.lock +160 -121
- data/README.md +67 -19
- data/SECURITY.md +1 -1
- data/app/assets/javascripts/shopify_app/redirect.js +3 -10
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +9 -4
- data/app/controllers/concerns/shopify_app/ensure_has_session.rb +25 -0
- data/app/controllers/concerns/shopify_app/ensure_installed.rb +84 -0
- data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +5 -1
- data/app/controllers/shopify_app/authenticated_controller.rb +1 -1
- data/app/controllers/shopify_app/callback_controller.rb +101 -39
- data/app/controllers/shopify_app/extension_verification_controller.rb +4 -1
- data/app/controllers/shopify_app/sessions_controller.rb +37 -7
- data/app/controllers/shopify_app/webhooks_controller.rb +1 -1
- data/app/views/shopify_app/layouts/app_bridge.html.erb +17 -0
- data/app/views/shopify_app/sessions/patch_shopify_id_token.html.erb +0 -0
- data/app/views/shopify_app/shared/redirect.html.erb +10 -1
- data/config/locales/cs.yml +0 -18
- data/config/locales/da.yml +0 -15
- data/config/locales/de.yml +0 -17
- data/config/locales/en.yml +0 -11
- data/config/locales/es.yml +0 -17
- data/config/locales/fi.yml +0 -15
- data/config/locales/fr.yml +0 -18
- data/config/locales/it.yml +0 -16
- data/config/locales/ja.yml +0 -12
- data/config/locales/ko.yml +0 -14
- data/config/locales/nb.yml +0 -16
- data/config/locales/nl.yml +0 -16
- data/config/locales/pl.yml +0 -16
- data/config/locales/pt-BR.yml +0 -16
- data/config/locales/pt-PT.yml +0 -17
- data/config/locales/sv.yml +0 -16
- data/config/locales/th.yml +0 -15
- data/config/locales/tr.yml +0 -17
- data/config/locales/vi.yml +0 -17
- data/config/locales/zh-CN.yml +0 -11
- data/config/locales/zh-TW.yml +0 -11
- data/config/routes.rb +2 -1
- data/docs/Quickstart.md +14 -5
- data/docs/Troubleshooting.md +38 -25
- data/docs/Upgrading.md +103 -32
- data/docs/shopify_app/authentication.md +179 -58
- data/docs/shopify_app/controller-concerns.md +89 -0
- data/docs/shopify_app/engine.md +2 -11
- data/docs/shopify_app/generators.md +2 -2
- data/docs/shopify_app/logging.md +21 -0
- data/docs/shopify_app/sessions.md +358 -0
- data/docs/shopify_app/testing.md +32 -10
- data/docs/shopify_app/webhooks.md +97 -7
- data/karma.conf.js +6 -4
- data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +6 -3
- data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -1
- data/lib/generators/shopify_app/add_app_uninstalled_job/add_app_uninstalled_job_generator.rb +15 -0
- data/lib/generators/shopify_app/add_app_uninstalled_job/templates/app_uninstalled_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_declarative_webhook/add_declarative_webhook_generator.rb +53 -0
- data/lib/generators/shopify_app/add_declarative_webhook/templates/webhook_controller.rb.tt +13 -0
- data/lib/generators/shopify_app/add_declarative_webhook/templates/webhook_job.rb.tt +15 -0
- data/lib/generators/shopify_app/add_privacy_jobs/add_privacy_jobs_generator.rb +23 -0
- data/lib/generators/shopify_app/add_privacy_jobs/templates/customers_data_request_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_privacy_jobs/templates/customers_redact_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_privacy_jobs/templates/shop_redact_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +8 -3
- data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +4 -2
- data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +1 -1
- data/lib/generators/shopify_app/authenticated_controller/templates/authenticated_controller.rb +1 -1
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +1 -1
- data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +1 -1
- data/lib/generators/shopify_app/install/install_generator.rb +4 -4
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +13 -3
- data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -1
- data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +1 -1
- data/lib/generators/shopify_app/routes/routes_generator.rb +1 -1
- data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +1 -1
- data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +1 -1
- data/lib/generators/shopify_app/shopify_app_generator.rb +2 -0
- data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +1 -1
- data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_expires_at_column.erb +5 -0
- data/lib/generators/shopify_app/user_model/user_model_generator.rb +21 -1
- data/lib/shopify_app/access_scopes/noop_strategy.rb +4 -0
- data/lib/shopify_app/access_scopes/user_strategy.rb +9 -2
- data/lib/shopify_app/admin_api/with_token_refetch.rb +27 -0
- data/lib/shopify_app/auth/post_authenticate_tasks.rb +48 -0
- data/lib/shopify_app/auth/token_exchange.rb +73 -0
- data/lib/shopify_app/configuration.rb +82 -1
- data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -3
- data/lib/shopify_app/controller_concerns/csrf_protection.rb +2 -1
- data/lib/shopify_app/controller_concerns/embedded_app.rb +42 -3
- data/lib/shopify_app/controller_concerns/ensure_billing.rb +28 -12
- data/lib/shopify_app/controller_concerns/frame_ancestors.rb +1 -1
- data/lib/shopify_app/controller_concerns/localization.rb +11 -8
- data/lib/shopify_app/controller_concerns/login_protection.rb +83 -38
- data/lib/shopify_app/controller_concerns/payload_verification.rb +1 -1
- data/lib/shopify_app/controller_concerns/redirect_for_embedded.rb +15 -3
- data/lib/shopify_app/controller_concerns/sanitized_params.rb +5 -0
- data/lib/shopify_app/controller_concerns/token_exchange.rb +111 -0
- data/lib/shopify_app/controller_concerns/webhook_verification.rb +4 -1
- data/lib/shopify_app/controller_concerns/with_shopify_id_token.rb +48 -0
- data/lib/shopify_app/engine.rb +7 -8
- data/lib/shopify_app/logger.rb +28 -0
- data/lib/shopify_app/managers/webhooks_manager.rb +20 -10
- data/lib/shopify_app/middleware/jwt_middleware.rb +13 -9
- data/lib/shopify_app/session/in_memory_user_session_store.rb +1 -1
- data/lib/shopify_app/session/jwt.rb +11 -2
- data/lib/shopify_app/session/session_repository.rb +66 -14
- data/lib/shopify_app/session/session_storage.rb +2 -2
- data/lib/shopify_app/session/shop_session_storage.rb +5 -1
- data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +5 -1
- data/lib/shopify_app/session/user_session_storage.rb +6 -2
- data/lib/shopify_app/session/user_session_storage_with_scopes.rb +27 -2
- data/lib/shopify_app/test_helpers/all.rb +1 -0
- data/lib/shopify_app/test_helpers/shopify_session_helper.rb +16 -0
- data/lib/shopify_app/utils.rb +82 -20
- data/lib/shopify_app/version.rb +1 -1
- data/lib/shopify_app.rb +12 -3
- data/package.json +5 -6
- data/service.yml +0 -2
- data/shopify_app.gemspec +6 -5
- data/translation.yml +1 -0
- data/yarn.lock +2139 -3910
- metadata +78 -58
- data/.github/workflows/stale.yml +0 -31
- data/app/assets/images/storage_access.svg +0 -1
- data/app/assets/javascripts/shopify_app/app_bridge_3.1.1.js +0 -10
- data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +0 -22
- data/app/assets/javascripts/shopify_app/app_bridge_utils_3.1.1.js +0 -1
- data/app/assets/javascripts/shopify_app/enable_cookies.js +0 -3
- data/app/assets/javascripts/shopify_app/itp_helper.js +0 -40
- data/app/assets/javascripts/shopify_app/partition_cookies.js +0 -8
- data/app/assets/javascripts/shopify_app/post_redirect.js +0 -9
- data/app/assets/javascripts/shopify_app/request_storage_access.js +0 -3
- data/app/assets/javascripts/shopify_app/storage_access.js +0 -148
- data/app/assets/javascripts/shopify_app/storage_access_redirect.js +0 -17
- data/app/assets/javascripts/shopify_app/top_level.js +0 -2
- data/app/assets/javascripts/shopify_app/top_level_interaction.js +0 -11
- data/app/controllers/concerns/shopify_app/authenticated.rb +0 -19
- data/app/controllers/concerns/shopify_app/require_known_shop.rb +0 -48
- data/app/views/shopify_app/sessions/enable_cookies.html.erb +0 -70
- data/app/views/shopify_app/sessions/request_storage_access.html.erb +0 -68
- data/app/views/shopify_app/sessions/top_level_interaction.html.erb +0 -63
- data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +0 -13
- data/docs/shopify_app/script-tags.md +0 -28
- data/docs/shopify_app/session-repository.md +0 -88
- data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +0 -41
- data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +0 -62
- data/lib/shopify_app/controller_concerns/itp.rb +0 -45
- data/lib/shopify_app/jobs/scripttags_manager_job.rb +0 -16
- data/lib/shopify_app/managers/scripttags_manager.rb +0 -84
data/config/locales/nb.yml
CHANGED
@@ -3,19 +3,3 @@ nb:
|
|
3
3
|
logged_out: Logget ut
|
4
4
|
could_not_log_in: Kunne ikke logge på Shopify-butikken
|
5
5
|
invalid_shop_url: Ugyldig butikkdomene
|
6
|
-
enable_cookies_heading: Aktiver informasjonskapsler fra %{app}
|
7
|
-
enable_cookies_body: Du kan manuelt aktivere informasjonskapsler i denne nettleseren
|
8
|
-
for å kunne bruke %{app} i Shopify.
|
9
|
-
enable_cookies_footer: Informasjonskapsler lar appen autentisere deg ved å midlertidig
|
10
|
-
lagre innstillingene og personopplysningene dine. De går ut etter 30 dager.
|
11
|
-
enable_cookies_action: Aktiver informasjonskapsler
|
12
|
-
top_level_interaction_heading: Nettleseren din må autentisere %{app}
|
13
|
-
top_level_interaction_body: Nettleseren din krever apper som %{app} for å spørre
|
14
|
-
deg om tilgang til informasjonskapsler før Shopify kan åpne den for deg.
|
15
|
-
top_level_interaction_action: Fortsett
|
16
|
-
request_storage_access_heading: "%{app} må ha tilgang til informasjonskapsler"
|
17
|
-
request_storage_access_body: Informasjonskapsler lar appen autentisere deg ved å
|
18
|
-
midlertidig lagre personopplysningene dine. Klikk på Fortsett og gi informasjonskapsler
|
19
|
-
tillatelse til å bruke appen.
|
20
|
-
request_storage_access_footer: Informasjonskapslene går ut etter 30 dager.
|
21
|
-
request_storage_access_action: Fortsett
|
data/config/locales/nl.yml
CHANGED
@@ -3,19 +3,3 @@ nl:
|
|
3
3
|
logged_out: Je bent afgemeld
|
4
4
|
could_not_log_in: Kon niet inloggen bij Shopify-winkel
|
5
5
|
invalid_shop_url: Ongeldig winkeldomein
|
6
|
-
enable_cookies_heading: Schakel cookies in van %{app}
|
7
|
-
enable_cookies_body: Je moet cookies in deze browser handmatig inschakelen om %{app}
|
8
|
-
binnen Shopify te gebruiken.
|
9
|
-
enable_cookies_footer: Met cookies kan de app je verifiëren door je voorkeuren en
|
10
|
-
persoonlijke informatie tijdelijk op te slaan. Ze vervallen na 30 dagen.
|
11
|
-
enable_cookies_action: Schakel cookies in
|
12
|
-
top_level_interaction_heading: Je browser moet %{app} verifiëren
|
13
|
-
top_level_interaction_body: Je browser heeft apps nodig zoals %{app} om je toegang
|
14
|
-
te vragen tot cookies voordat Shopify het voor je kan openen.
|
15
|
-
top_level_interaction_action: Doorgaan
|
16
|
-
request_storage_access_heading: "%{app} heeft toegang tot cookies nodig"
|
17
|
-
request_storage_access_body: Hiermee kan de app je verifiëren door je persoonlijke
|
18
|
-
gegevens tijdelijk op te slaan. Klik op Doorgaan en sta cookies toe om de app
|
19
|
-
te gebruiken.
|
20
|
-
request_storage_access_footer: Cookies verlopen na 30 dagen.
|
21
|
-
request_storage_access_action: Doorgaan
|
data/config/locales/pl.yml
CHANGED
@@ -3,19 +3,3 @@ pl:
|
|
3
3
|
logged_out: Pomyślne wylogowanie
|
4
4
|
could_not_log_in: Nie można zalogować się do sklepu Shopify
|
5
5
|
invalid_shop_url: Nieprawidłowa domena sklepu
|
6
|
-
enable_cookies_heading: Włącz korzystanie z plików cookie z %{app}
|
7
|
-
enable_cookies_body: Aby móc korzystać z %{app} w Shopify, musisz ręcznie włączyć
|
8
|
-
korzystanie z plików cookie w tej przeglądarce.
|
9
|
-
enable_cookies_footer: Pliki cookie umożliwiają uwierzytelnianie aplikacji przez
|
10
|
-
tymczasowe przechowywanie preferencji i danych osobowych. Wygasają one po 30 dniach.
|
11
|
-
enable_cookies_action: Włącz korzystanie z plików cookie
|
12
|
-
top_level_interaction_heading: Twoja przeglądarka wymaga uwierzytelnienia %{app}
|
13
|
-
top_level_interaction_body: Twoja przeglądarka wymaga takich aplikacji jak %{app},
|
14
|
-
aby poprosić o dostęp do plików cookie, zanim Shopify będzie mógł ją otworzyć.
|
15
|
-
top_level_interaction_action: Kontynuuj
|
16
|
-
request_storage_access_heading: "%{app} potrzebuje dostępu do plików cookie"
|
17
|
-
request_storage_access_body: Dzięki temu aplikacja może Cię uwierzytelniać, tymczasowo,
|
18
|
-
przechowując Twoje dane osobowe. Kliknij przycisk Kontynuuj i zezwalaj na pliki
|
19
|
-
cookie, aby korzystać z aplikacji.
|
20
|
-
request_storage_access_footer: Pliki cookie wygasają po 30 dniach.
|
21
|
-
request_storage_access_action: Kontynuuj
|
data/config/locales/pt-BR.yml
CHANGED
@@ -3,19 +3,3 @@ pt-BR:
|
|
3
3
|
logged_out: Você saiu.
|
4
4
|
could_not_log_in: Não foi possível fazer login na Shopify store
|
5
5
|
invalid_shop_url: Domínio de loja inválido
|
6
|
-
enable_cookies_heading: Habilitar cookies de %{app}
|
7
|
-
enable_cookies_body: Você precisa habilitar manualmente os cookies neste navegador
|
8
|
-
para usar %{app} dentro da Shopify.
|
9
|
-
enable_cookies_footer: Os cookies permitem que o app o autentique armazenando temporariamente
|
10
|
-
suas preferências e dados pessoais. Eles expiram depois de 30 dias.
|
11
|
-
enable_cookies_action: Habilitar cookies
|
12
|
-
top_level_interaction_heading: Seu navegador precisa autenticar %{app}
|
13
|
-
top_level_interaction_body: Seu navegador exige que apps como o %{app} consultem
|
14
|
-
você sobre o acesso a cookies antes que a Shopify os abra.
|
15
|
-
top_level_interaction_action: Continuar
|
16
|
-
request_storage_access_heading: "%{app} precisa acessar cookies"
|
17
|
-
request_storage_access_body: Isso permite que o app autentique você armazenando
|
18
|
-
temporariamente seus dados pessoais. Clique em continuar e permita os cookies
|
19
|
-
para usar o app.
|
20
|
-
request_storage_access_footer: Os cookies expiram depois de 30 dias.
|
21
|
-
request_storage_access_action: Continuar
|
data/config/locales/pt-PT.yml
CHANGED
@@ -3,20 +3,3 @@ pt-PT:
|
|
3
3
|
logged_out: Terminou a sessão com sucesso
|
4
4
|
could_not_log_in: Não foi possível iniciar sessão na loja da Shopify
|
5
5
|
invalid_shop_url: Domínio de loja inválido
|
6
|
-
enable_cookies_heading: Ativar cookies de %{app}
|
7
|
-
enable_cookies_body: Tem de ativar manualmente os cookies neste navegador para utilizar
|
8
|
-
%{app} dentro da Shopify.
|
9
|
-
enable_cookies_footer: Os cookies permitem que a aplicação o autentique armazenando
|
10
|
-
temporariamente as suas preferências e informações pessoais. Expiram ao fim de
|
11
|
-
30 dias.
|
12
|
-
enable_cookies_action: Ativar cookies
|
13
|
-
top_level_interaction_heading: O seu navegador tem de autenticar %{app}
|
14
|
-
top_level_interaction_body: O seu navegador exige que aplicações como %{app} lhe
|
15
|
-
solicitem o acesso de cookies, antes que a Shopify as possa abrir.
|
16
|
-
top_level_interaction_action: Continuar
|
17
|
-
request_storage_access_heading: "%{app} tem de aceder a cookies"
|
18
|
-
request_storage_access_body: Isto permite que a aplicação o autentique armazenando
|
19
|
-
temporariamente as suas informações pessoais. Clique em continuar e permita os
|
20
|
-
cookies para utilizar a aplicação.
|
21
|
-
request_storage_access_footer: Os cookies expiram ao fim de 30 dias.
|
22
|
-
request_storage_access_action: Continuar
|
data/config/locales/sv.yml
CHANGED
@@ -3,19 +3,3 @@ sv:
|
|
3
3
|
logged_out: Har loggats ut
|
4
4
|
could_not_log_in: Det gick inte att logga in i Shopify-butiken
|
5
5
|
invalid_shop_url: Ogiltig butiksdomän
|
6
|
-
enable_cookies_heading: Aktivera cookies från %{app}
|
7
|
-
enable_cookies_body: Du måste aktivera cookies manuellt i den här webbläsaren för
|
8
|
-
att kunna använda %{app} inom Shopify.
|
9
|
-
enable_cookies_footer: Cookies låter appen autentisera dig genom att tillfälligt
|
10
|
-
lagra dina inställningar och personuppgifter. De upphör efter 30 dagar.
|
11
|
-
enable_cookies_action: Aktivera cookies
|
12
|
-
top_level_interaction_heading: Din webbläsare måste verifiera %{app}
|
13
|
-
top_level_interaction_body: Din webbläsare kräver att appar som %{app} frågar dig
|
14
|
-
om tillgång till cookies innan Shopify kan öppna den för dig.
|
15
|
-
top_level_interaction_action: Fortsätt
|
16
|
-
request_storage_access_heading: "%{app} behöver tillgång till cookies"
|
17
|
-
request_storage_access_body: Detta gör det möjligt för appen att autentisera dig
|
18
|
-
genom att tillfälligt lagra din personliga information. Klicka på fortsätt och
|
19
|
-
tillåta cookies att använda appen.
|
20
|
-
request_storage_access_footer: Cookies upphör efter 30 dagar.
|
21
|
-
request_storage_access_action: Fortsätt
|
data/config/locales/th.yml
CHANGED
@@ -3,18 +3,3 @@ th:
|
|
3
3
|
logged_out: ออกจากระบบสำเร็จ
|
4
4
|
could_not_log_in: ไม่สามารถเข้าสู่ระบบร้านค้า Shopify ได้
|
5
5
|
invalid_shop_url: โดเมนร้านค้าไม่ถูกต้อง
|
6
|
-
enable_cookies_heading: เปิดใช้คุกกี้จาก %{app}
|
7
|
-
enable_cookies_body: คุณต้องเปิดใช้คุกกี้ด้วยตนเองในเบราว์เซอร์นี้เพื่อใช้งาน %{app}
|
8
|
-
ภายใน Shopify
|
9
|
-
enable_cookies_footer: คุกกี้ช่วยให้แอปตรวจสอบความถูกต้องของคุณด้วยการจัดเก็บความชื่นชอบและข้อมูลส่วนตัวของคุณชั่วคราว
|
10
|
-
คุกกี้จะหมดอายุหลังจาก 30 วัน
|
11
|
-
enable_cookies_action: เปิดใช้คุกกี้
|
12
|
-
top_level_interaction_heading: เบราว์เซอร์ของคุณต้องรับรองความถูกต้องของ %{app}
|
13
|
-
top_level_interaction_body: เบราว์เซอร์ของคุณต้องการแอปอย่าง %{app} เพื่อขอให้คุณเข้าถึงคุกกี้ก่อนที่
|
14
|
-
Shopify จะสามารถเปิดมันให้คุณได้
|
15
|
-
top_level_interaction_action: ดำเนินการต่อ
|
16
|
-
request_storage_access_heading: "%{app} ต้องการสิทธิ์การเข้าถึงคุกกี้"
|
17
|
-
request_storage_access_body: สิ่งนี้ช่วยให้แอปตรวจสอบความถูกต้องของคุณด้วยการจัดเก็บข้อมูลส่วนตัวของคุณชั่วคราว
|
18
|
-
คลิกดำเนินการต่อและอนุญาตให้คุกกี้ใช้แอป
|
19
|
-
request_storage_access_footer: คุกกี้จะหมดอายุหลังจาก 30 วัน
|
20
|
-
request_storage_access_action: ดำเนินการต่อ
|
data/config/locales/tr.yml
CHANGED
@@ -3,20 +3,3 @@ tr:
|
|
3
3
|
logged_out: Oturum başarıyla kapatıldı
|
4
4
|
could_not_log_in: Shopify mağazasında oturum açılamadı
|
5
5
|
invalid_shop_url: Geçersiz mağaza alan adı
|
6
|
-
enable_cookies_heading: "%{app} uygulamasından çerezleri etkinleştir"
|
7
|
-
enable_cookies_body: "%{app} uygulamasını Shopify içinde kullanabilmek için bu tarayıcıda
|
8
|
-
çerezleri manuel olarak etkinleştirmelisiniz."
|
9
|
-
enable_cookies_footer: Çerezler, tercihlerinizi ve kişisel bilgilerinizi geçici
|
10
|
-
olarak saklayıp uygulamanın kimliğinizi doğrulamasına imkan tanır. Çerezlerin
|
11
|
-
süresi 30 gün sonra sonra sona erer.
|
12
|
-
enable_cookies_action: Çerezleri etkinleştir
|
13
|
-
top_level_interaction_heading: Tarayıcınızın %{app} kimliğini doğrulaması gerekiyor
|
14
|
-
top_level_interaction_body: Tarayıcınız, Shopify tarafından açılmadan önce %{app}
|
15
|
-
gibi uygulamaların sizden çerezlere erişim izni istemesini zorunlu tutuyor.
|
16
|
-
top_level_interaction_action: Devam
|
17
|
-
request_storage_access_heading: "%{app} uygulamasının çerezlere erişmesi gerekiyor"
|
18
|
-
request_storage_access_body: Böylece uygulama, kişisel bilgilerinizi geçici olarak
|
19
|
-
saklayıp kimliğinizi doğrulayabilir. Devam et'e tıklayın ve çerezlerin uygulamayı
|
20
|
-
kullanmasına izin verin.
|
21
|
-
request_storage_access_footer: Çerezlerin süresi 30 gün sonra sonra sona erer.
|
22
|
-
request_storage_access_action: Devam
|
data/config/locales/vi.yml
CHANGED
@@ -3,20 +3,3 @@ vi:
|
|
3
3
|
logged_out: Đã đăng xuất thành công
|
4
4
|
could_not_log_in: Không thể đăng nhập vào cửa hàng trên Shopify
|
5
5
|
invalid_shop_url: Miền cửa hàng không hợp lệ
|
6
|
-
enable_cookies_heading: Bật cookie từ %{app}
|
7
|
-
enable_cookies_body: Bạn phải bật cookie trong trình duyệt này theo cách thủ công
|
8
|
-
để sử dụng %{app} trong Shopify.
|
9
|
-
enable_cookies_footer: Cookie cho phép ứng dụng xác thực bạn bằng cách tạm thời
|
10
|
-
lưu trữ tùy chọn và thông tin cá nhân của bạn. Những thông tin này sẽ hết hạn
|
11
|
-
sau 30 ngày.
|
12
|
-
enable_cookies_action: Bật cookie
|
13
|
-
top_level_interaction_heading: Trình duyệt của bạn cần xác thực %{app}
|
14
|
-
top_level_interaction_body: Trình duyệt của bạn cần các ứng dụng như %{app} để yêu
|
15
|
-
cầu quyền truy cập vào cookie thì Shopify mới có thể mở giúp bạn.
|
16
|
-
top_level_interaction_action: Tiếp tục
|
17
|
-
request_storage_access_heading: "%{app} cần quyền truy cập cookie"
|
18
|
-
request_storage_access_body: Nhờ vậy, ứng dụng có thể xác thực bạn bằng cách tạm
|
19
|
-
thời lưu trữ thông tin cá nhân của bạn. Nhấp vào tiếp tục và cho phép cookie sử
|
20
|
-
dụng ứng dụng.
|
21
|
-
request_storage_access_footer: Cookie sẽ hết hạn sau 30 ngày.
|
22
|
-
request_storage_access_action: Tiếp tục
|
data/config/locales/zh-CN.yml
CHANGED
@@ -3,14 +3,3 @@ zh-CN:
|
|
3
3
|
logged_out: 已成功退出
|
4
4
|
could_not_log_in: 无法登录到 Shopify 商店
|
5
5
|
invalid_shop_url: 商店域名无效
|
6
|
-
enable_cookies_heading: 从 %{app} 启用 Cookie
|
7
|
-
enable_cookies_body: 您必须在此浏览器中手动启用 Cookie 才能在 Shopify 中使用 %{app}。
|
8
|
-
enable_cookies_footer: Cookie 使此应用能够通过暂时存储您的偏好设置和个人信息来验证您的身份。这些信息将在 30 天后过期。
|
9
|
-
enable_cookies_action: 启用 Cookie
|
10
|
-
top_level_interaction_heading: 您的浏览器需要对 %{app} 进行验证
|
11
|
-
top_level_interaction_body: 您的浏览器要求类似 %{app} 的应用向您申请访问 Cookie,之后 Shopify 才能为您打开它。
|
12
|
-
top_level_interaction_action: 继续
|
13
|
-
request_storage_access_heading: "%{app} 需要访问 Cookie"
|
14
|
-
request_storage_access_body: 这使此应用能够通过暂时存储您的个人信息来验证您的身份。点击继续并启用 Cookie 以使用此应用。
|
15
|
-
request_storage_access_footer: Cookie 将在 30 天后过期。
|
16
|
-
request_storage_access_action: 继续
|
data/config/locales/zh-TW.yml
CHANGED
@@ -3,14 +3,3 @@ zh-TW:
|
|
3
3
|
logged_out: 登出成功
|
4
4
|
could_not_log_in: 無法登入 Shopify 商店
|
5
5
|
invalid_shop_url: 商店網域無效
|
6
|
-
enable_cookies_heading: 啟用 %{app} 的 Cookie
|
7
|
-
enable_cookies_body: 您必須在此瀏覽器中手動啟用 Cookie,才能夠在 Shopify 使用 %{app}。
|
8
|
-
enable_cookies_footer: Cookie 可讓應用程式暫時儲存您的偏好設定和個人資訊,藉此驗證您的身分,這些資料會在 30 天後失效。
|
9
|
-
enable_cookies_action: 啟用 Cookie
|
10
|
-
top_level_interaction_heading: 您的瀏覽器需要驗證 %{app}
|
11
|
-
top_level_interaction_body: 您的瀏覽器要求 %{app} 等應用程式向您請求 Cookie 的存取權限,才能讓 Shopify 為您開啟該應用程式。
|
12
|
-
top_level_interaction_action: 繼續
|
13
|
-
request_storage_access_heading: "%{app} 需要 Cookie 存取權限"
|
14
|
-
request_storage_access_body: Cookie 可讓應用程式暫時儲存您的個人資訊,藉此驗證您的身分。按一下繼續並允許 Cookie 使用此應用程式。
|
15
|
-
request_storage_access_footer: Cookie 將於 30 天後失效。
|
16
|
-
request_storage_access_action: 繼續
|
data/config/routes.rb
CHANGED
@@ -8,6 +8,7 @@ ShopifyApp::Engine.routes.draw do
|
|
8
8
|
get login_url => :new, :as => :login
|
9
9
|
post login_url => :create, :as => :authenticate
|
10
10
|
get "logout" => :destroy, :as => :logout
|
11
|
+
get "patch_shopify_id_token" => :patch_shopify_id_token
|
11
12
|
|
12
13
|
# Kept to prevent apps relying on these routes from breaking
|
13
14
|
if login_url.gsub(%r{^/}, "") != "login"
|
@@ -26,6 +27,6 @@ ShopifyApp::Engine.routes.draw do
|
|
26
27
|
end
|
27
28
|
|
28
29
|
namespace :webhooks do
|
29
|
-
post ":type" => :receive
|
30
|
+
post "(:type)" => :receive
|
30
31
|
end
|
31
32
|
end
|
data/docs/Quickstart.md
CHANGED
@@ -4,13 +4,15 @@ This guide assumes you have completed the steps to create a new Rails app using
|
|
4
4
|
|
5
5
|
#### Table of contents
|
6
6
|
|
7
|
-
[Setup SSH tunnel for development](#setup-ssh-tunnel-for-development)
|
7
|
+
[Optionally Setup SSH tunnel for development](#setup-ssh-tunnel-for-development)
|
8
8
|
|
9
9
|
[Use Shopify App Bridge to embed your app in the Shopify Admin](#use-shopify-app-bridge-to-embed-your-app-in-the-shopify-admin)
|
10
10
|
|
11
|
-
## Setup SSH tunnel for development
|
11
|
+
## Optionally Setup SSH tunnel for development
|
12
12
|
|
13
|
-
|
13
|
+
Local development supports both `http` and `https` schemes. By default `http` and localhost are used.
|
14
|
+
|
15
|
+
To use `https`, your local app needs to be accessible from the public Internet in order to install it on a Shopify store to use the [App Proxy Controller](/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb) or receive [webhooks](/docs/shopify_app/webhooks.md).
|
14
16
|
|
15
17
|
In order to receive requests securely, you'll need to setup a tunnel from the internet to localhost. You can use [Cloudflare](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/run-tunnel/trycloudflare/) for this.
|
16
18
|
|
@@ -32,8 +34,15 @@ HOST='https://some-random-words.trycloudflare.com/'
|
|
32
34
|
|
33
35
|
## Use Shopify App Bridge to embed your app in the Shopify Admin
|
34
36
|
|
35
|
-
A basic example of using [*Shopify App Bridge*](https://shopify.dev/tools/app-bridge) is included in the install generator. An instance Shopify App Bridge is automatically initialized in [shopify_app.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/shopify_app.js).
|
37
|
+
A basic example of using [*Shopify App Bridge*](https://shopify.dev/tools/app-bridge) is included in the install generator. An instance Shopify App Bridge is automatically initialized in [shopify_app.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/shopify_app.js).
|
38
|
+
|
39
|
+
If you are using the `shopify_app` gem **without** the [frontend react template](https://github.com/Shopify/shopify-frontend-template-react), the [flash_messages.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/flash_messages.js) file converts Rails [flash messages](https://api.rubyonrails.org/classes/ActionDispatch/Flash.html) to App Bridge Toast actions automatically. If your app is embedded and you want to display flash messages you will need to update the session storage to allow for 3rd party cookies. So that the flash messages can be save in the session cookie.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
#session_store.rb
|
43
|
+
Rails.application.config.session_store(:cookie_store, key: '_example_session', expire_after: 14.days, secure: true, same_site: 'None')
|
44
|
+
```
|
36
45
|
|
37
|
-
|
46
|
+
By default, this library is included via [unpkg in the embedded_app layout](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/embedded_app.html.erb#L27).
|
38
47
|
|
39
48
|
For more advanced uses it is recommended to [install App Bridge via npm or yarn](https://help.shopify.com/en/api/embedded-apps/app-bridge/getting-started#set-up-shopify-app-bridge-in-your-app).
|
data/docs/Troubleshooting.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#### Table of contents
|
4
4
|
|
5
5
|
[Generators](#generators)
|
6
|
-
* [The `shopify_app:install` generator hangs](#the-
|
6
|
+
* [The `shopify_app:install` generator hangs](#the-shopify_appinstall-generator-hangs)
|
7
7
|
|
8
8
|
[Rails](#rails)
|
9
9
|
* [Known issues with Rails `v6.1`](#known-issues-with-rails-v61)
|
@@ -18,6 +18,8 @@
|
|
18
18
|
* [My app can't make requests to the Shopify API](#my-app-cant-make-requests-to-the-shopify-api)
|
19
19
|
* [I'm stuck in a redirect loop after OAuth](#im-stuck-in-a-redirect-loop-after-oauth)
|
20
20
|
|
21
|
+
[Debugging Tips](#debugging-tips)
|
22
|
+
|
21
23
|
## Generators
|
22
24
|
|
23
25
|
### The shopify_app:install generator hangs
|
@@ -90,29 +92,6 @@ Edit `config/initializer/shopify_app.rb` and ensure the following configurations
|
|
90
92
|
+ config.shop_session_repository = 'Shop'
|
91
93
|
```
|
92
94
|
|
93
|
-
#### Inspect server logs
|
94
|
-
|
95
|
-
If you have checked the configurations above, and the app is still using cookies, then it is possible that the `shopify_app` gem defaulted to relying on cookies. This would happen when your browser allows third-party cookies and a session token was not successfully found as part of your request.
|
96
|
-
|
97
|
-
In this case, check the server logs to see if the session token was invalid:
|
98
|
-
|
99
|
-
```los
|
100
|
-
[ShopifyApp::JWT] Failed to validate JWT: [JWT::<Error>] <Failure message>
|
101
|
-
```
|
102
|
-
|
103
|
-
*Example*
|
104
|
-
|
105
|
-
```
|
106
|
-
[ShopifyApp::JWT] Failed to validate JWT: [JWT::ImmatureSignature] Signature nbf has not been reached
|
107
|
-
```
|
108
|
-
|
109
|
-
**Note:** In a local development environment, you may want to temporarily update your `Gemfile` to point to a local instance of the `shopify_app` library instad of an installed gem. This will enable you to use a debugging tool like `byebug` to debug the library.
|
110
|
-
|
111
|
-
```diff
|
112
|
-
- gem 'shopify_app', '~> 14.2'
|
113
|
-
+ gem 'shopify_app', path: '/path/to/shopify_app'
|
114
|
-
```
|
115
|
-
|
116
95
|
### My app can't make requests to the Shopify API
|
117
96
|
|
118
97
|
> **Note:** Session tokens cannot be used to make authenticated requests to the Shopify API. Learn more about authenticating your backend requests to Shopify APIs at [Shopify API authentication](https://shopify.dev/concepts/about-apis/authentication).
|
@@ -143,9 +122,43 @@ X-Shopify-API-Request-Failure-Unauthorized: true
|
|
143
122
|
|
144
123
|
Then, use the [Shopify App Bridge Redirect](https://shopify.dev/tools/app-bridge/actions/navigation/redirect) action to redirect your app frontend to the app login URL if this header is set.
|
145
124
|
|
146
|
-
|
147
125
|
### I'm stuck in a redirect loop after OAuth
|
148
126
|
|
149
127
|
In previous versions of `ShopifyApp::Authenticated` controller concern, App Bridge embedded apps were able to include the `Authenticated` controller concern in the `HomeController` and other embedded controllers. This is no longer supported due to browsers blocking 3rd party cookies to increase privacy. App Bridge 3 is needed to handle all embedded sessions.
|
150
128
|
|
151
129
|
For more details on how to handle embeded sessions, refer to [the session token documentation](https://shopify.dev/apps/auth/oauth/session-tokens).
|
130
|
+
|
131
|
+
### `redirect_uri is not whitelisted`
|
132
|
+
|
133
|
+
* Ensure you have set the `HOST` environment variable to match your host's URL, e.g. `http://localhost:3000` or `https://my-host-name.trycloudflare.com`.
|
134
|
+
* Update the app's URL and whitelisted URLs in App Setup on https://partners.shopify.com
|
135
|
+
|
136
|
+
### `This app can’t load due to an issue with browser cookies`
|
137
|
+
|
138
|
+
This can be caused by an infinite redirect due to a coding error
|
139
|
+
To investigate the cause, you can add a breakpoint or logging to the `rescue` clause of `ShopifyApp::CallbackController`.
|
140
|
+
|
141
|
+
One possible cause is that for XHR requests, the `Authenticated` concern should be used, rather than `RequireKnownShop`.
|
142
|
+
See below for further details.
|
143
|
+
|
144
|
+
## Controller Concerns
|
145
|
+
### Authenticated vs RequireKnownShop
|
146
|
+
The gem heavily relies on the `current_shopify_domain` helper to contextualize a request to a given Shopify shop. This helper is set in different and conflicting ways if the request is authenticated or not.
|
147
|
+
|
148
|
+
Because of these conflicting approaches the `Authenticated` (for use in authenticated requests) and `RequireKnownShop` (for use in unauthenticated requests) controller concerns must *never* be included within the same controller.
|
149
|
+
|
150
|
+
#### Authenticated Requests
|
151
|
+
For authenticated requests, use the [`Authenticated` controller concern](https://github.com/Shopify/shopify_app/blob/main/app/controllers/concerns/shopify_app/authenticated.rb). The `current_shopify_domain` is set from the JWT for these requests.
|
152
|
+
|
153
|
+
#### Unauthenticated Requests
|
154
|
+
For unauthenticated requests, use the [`RequireKnownShop` controller concern](https://github.com/Shopify/shopify_app/blob/main/app/controllers/concerns/shopify_app/require_known_shop.rb). The `current_shopify_domain` is set from the query string parameters that are passed.
|
155
|
+
|
156
|
+
## Debugging Tips
|
157
|
+
|
158
|
+
If you do run into issues with the gem there are two useful techniques to apply: Adding log statements, and using an interactive debugger, such as `pry`.
|
159
|
+
|
160
|
+
You can temporarily add log statements or debugger calls to the `shopify_app` or `shopify-api-ruby` gems:
|
161
|
+
* You can modify a gem using [`bundle open`](https://boringrails.com/tips/bundle-open-debug-gems)
|
162
|
+
* Alternatively, you can your modify your `Gemfile` to use local locally checked out gems with the the [`path` option](https://bundler.io/man/gemfile.5.html).
|
163
|
+
|
164
|
+
Note that if you make changes to a gem, you will need to restart the app for the changes to be applied.
|
data/docs/Upgrading.md
CHANGED
@@ -4,6 +4,16 @@ This file documents important changes needed to upgrade your app's Shopify App v
|
|
4
4
|
|
5
5
|
#### Table of contents
|
6
6
|
|
7
|
+
[General Advice](#general-advice)
|
8
|
+
|
9
|
+
[Unreleased](#unreleased)
|
10
|
+
|
11
|
+
[Upgrading to `v22.2.0`](#upgrading-to-v2220)
|
12
|
+
|
13
|
+
[Upgrading to `v22.0.0`](#upgrading-to-v2200)
|
14
|
+
|
15
|
+
[Upgrading to `v20.3.0`](#upgrading-to-v2030)
|
16
|
+
|
7
17
|
[Upgrading to `v20.2.0`](#upgrading-to-v2020)
|
8
18
|
|
9
19
|
[Upgrading to `v20.1.0`](#upgrading-to-v2010)
|
@@ -20,7 +30,88 @@ This file documents important changes needed to upgrade your app's Shopify App v
|
|
20
30
|
|
21
31
|
[Upgrading from `v8.6` to `v9.0.0`](#upgrading-from-v86-to-v900)
|
22
32
|
|
33
|
+
## General Advice
|
34
|
+
|
35
|
+
Although we strive to make upgrades as smooth as possible, some effort may be required to stay up to date with the latest changes to `shopify_app`.
|
36
|
+
|
37
|
+
We strongly recommend you avoid 'monkeypatching' any existing code from `ShopifyApp`, e.g. by inheriting from `ShopifyApp` and then overriding particular methods. This can result in difficult upgrades. If your app does so, you will need to carefully check the gem's internal changes when upgrading.
|
38
|
+
|
39
|
+
If you need to upgrade by more than one major version (e.g. from v18 to v20), we recommend doing one at a time. Deploy each into production to help to detect problems earlier.
|
40
|
+
|
41
|
+
We also recommend the use of a staging site which matches your production environment as closely as possible.
|
42
|
+
|
43
|
+
If you do run into issues, we recommend looking at our [debugging tips.](https://github.com/Shopify/shopify_app/blob/main/docs/Troubleshooting.md#debugging-tips)
|
44
|
+
|
45
|
+
## Unreleased
|
46
|
+
|
47
|
+
#### (v23.0.0) - Deprecated methods in CallbackController
|
48
|
+
The following methods from `ShopifyApp::CallbackController` have been deprecated in `v23.0.0`
|
49
|
+
- `perform_after_authenticate_job`
|
50
|
+
- `install_webhooks`
|
51
|
+
- `perform_post_authenticate_jobs`
|
52
|
+
|
53
|
+
If you have overwritten these methods in your callback controller to modify the behavior of the inherited `CallbackController`, you will need to
|
54
|
+
update your app to use configurable option `config.custom_post_authenticate_tasks` instead. See [post authenticate tasks](/docs/shopify_app/authentication.md#post-authenticate-tasks)
|
55
|
+
for more information.
|
56
|
+
|
57
|
+
#### (v23.0.0) - Removed `ShopifyApp::JWTMiddleware`
|
58
|
+
The `ShopifyApp::JWTMiddleware` middleware has been removed in `v23.0.0`. This middleware was used to populate the following environment variables from the JWT session token:
|
59
|
+
- `request.env["jwt.token"]`
|
60
|
+
- `request.env["jwt.shopify_domain"]`
|
61
|
+
- `request.env["jwt.shopify_user_id"]`
|
62
|
+
- `request.env["jwt.expire_at"]`
|
63
|
+
|
64
|
+
If you are using any of these variables in your app, you'll need to replace them. You can instead include the `ShopifyApp::WithShopifyIdToken` concern, which does the same JWT parsing as the middleware, and exposes the same values in the following helper methods:
|
65
|
+
- `shopify_id_token`
|
66
|
+
- `jwt_shopify_domain`
|
67
|
+
- `jwt_shopify_user_id`
|
68
|
+
- `jwt_expire_at`
|
69
|
+
|
70
|
+
#### (v23.0.0) - Deprecated "ShopifyApp::JWT" class
|
71
|
+
The `ShopifyApp::JWT` class has been deprecated in `v23.0.0`. Use [ShopifyAPI::Auth::JwtPayload](https://github.com/Shopify/shopify-api-ruby/blob/main/lib/shopify_api/auth/jwt_payload.rb)
|
72
|
+
class from the `shopify_api` gem instead. A search and replace should be enough for this migration.
|
73
|
+
- `ShopifyAPI::Auth::JwtPayload` is a superset of the `ShopifyApp::JWT` class, and contains methods that were available in `ShopifyApp::JWT`.
|
74
|
+
- `ShopifyAPI::Auth::JwtPayload` raises `ShopifyAPI::Errors::InvalidJwtTokenError` if the token is invalid.
|
75
|
+
|
76
|
+
## Upgrading to `v22.2.0`
|
77
|
+
#### Added new feature for zero redirect embedded app authorization flow - Token Exchange
|
78
|
+
A new embedded app authorization strategy has been introduced in `v22.2.0` that eliminates the redirects that were previously necessary for OAuth.
|
79
|
+
It can replace the existing installation and authorization code grant flow.
|
80
|
+
See [new embedded app authorization strategy](/README.md#new-embedded-app-authorization-strategy-token-exchange) for more information.
|
81
|
+
|
82
|
+
## Upgrading to `v22.0.0`
|
83
|
+
#### Dropped support for Ruby 2.x
|
84
|
+
Support for Ruby 2.x has been dropped as it is no longer supported. You'll need to upgrade to 3.x.x
|
85
|
+
|
86
|
+
#### Renamed Controller Concerns
|
87
|
+
The following controller concerns have been renamed/replaced in `v21.10.0` and have now been removed. To upgrade, please rename any usage in your apps's controllers that include them to the following:
|
88
|
+
|
89
|
+
|Old Deprecated Controller Concern |Replaced By New Controller Concern|
|
90
|
+
|---|---|
|
91
|
+
|`Authenticated`|`EnsureHasSession`|
|
92
|
+
|`RequireKnownShop`|`EnsureInstalled`|
|
93
|
+
|
94
|
+
The new names better reflect what assurances the including the controller concern provide. The new concern provide similar if not identical functionality as the concerns they replaced.
|
95
|
+
|
96
|
+
#### Remove ScripttagManager
|
97
|
+
Script tag usage has largely been replaced with the adoption of [theme app extensions](https://shopify.dev/docs/apps/online-store/theme-app-extensions) and [thank you order status customization](https://shopify.dev/docs/apps/checkout/thank-you-order-status). The manager has been removed with this major release due to effective replacement and a goal to have parity in supported functionality across language stacks.
|
98
|
+
|
99
|
+
If you find yourself still using Scipt Tags and want to continue the pattern of declarative management of script tags this gem used to use, we recommend porting the logic [the manager used in prior versions](https://github.com/Shopify/shopify_app/blob/2336fabc6d0b45a4dee3f336455dace4d2d88bc4/lib/shopify_app/managers/scripttags_manager.rb#L4) and implementing it in a [post authentication job](https://github.com/Shopify/shopify_app/blob/main/docs/shopify_app/authentication.md#run-jobs-after-the-oauth-flow). This is the recommended flow to create script tags (or any other logic) for stores that install your app.
|
100
|
+
|
101
|
+
#### No longer rescue non-shopify API errors during customized OAuth flow
|
102
|
+
If you have customized authentication logic and are counting on the `CallbackController` to catch your error and redirect to login, you'll need to catch that error and redirect to `login_url_with_optional_shop`.
|
103
|
+
|
104
|
+
## Upgrading to 21.3.0
|
105
|
+
The `Itp` controller concern has been removed from `LoginProtection` which is included by the `Authenticated`/`EnsureHasSession` controller concern.
|
106
|
+
If any of your controllers are dependant on methods from `Itp` then you can include `ShopifyApp::Itp` directly.
|
107
|
+
You may notice a deprecation notice saying, `Itp will be removed in an upcoming version`.
|
108
|
+
This is because we intend on removing `Itp` completely in `v22.0.0`, but this will work in the meantime.
|
109
|
+
|
110
|
+
## Upgrading to `v20.3.0`
|
111
|
+
Calling `LoginProtection#current_shopify_domain` will no longer raise an error if there is no active session. It will now return a nil value. The internal behavior of raising an error on OAuth redirect is still in place, however. If you were calling `current_shopify_domain` in authenticated actions and expecting an error if nil, you'll need to do a presence check and raise that error within your app.
|
112
|
+
|
23
113
|
## Upgrading to `v20.2.0`
|
114
|
+
|
24
115
|
All custom errors defined inline within the `ShopifyApp` gem have been moved to `lib/shopify_app/errors.rb`.
|
25
116
|
|
26
117
|
- If you rescue any errors defined in this gem, you will need to rename them to match their new namespacing.
|
@@ -36,8 +127,11 @@ Note that the following steps are *optional* and only apply to **embedded** appl
|
|
36
127
|
|
37
128
|
## Upgrading to `v19.0.0`
|
38
129
|
|
39
|
-
|
40
|
-
|
130
|
+
There are several major changes in this release:
|
131
|
+
|
132
|
+
* A change of strategy regarding sessions: Due to security changes with browsers, support for cookie based sessions was dropped. JWT is now the only supported method for managing sessions.
|
133
|
+
* As part of that change, this update moves API authentication logic from this gem to the [`shopify_api`](https://github.com/Shopify/shopify-api-ruby) gem.
|
134
|
+
* Previously the `shopify_api` gem relied on `ActiveResource`, an outdated library which was [removed](https://github.com/rails/rails/commit/f1637bf2bb00490203503fbd943b73406e043d1d) from Rails in 2012. v10 of `shopify_api` has a replacement approach which aims to provide a similar syntax, but changes will be necessary.
|
41
135
|
|
42
136
|
### High-level process
|
43
137
|
|
@@ -48,18 +142,20 @@ gem.
|
|
48
142
|
- Remove `allow_jwt_authentication=` and `allow_cookie_authentication=` invocations from
|
49
143
|
`config/initializers/shopify_app.rb` as the decision logic for which authentication method to use is now handled
|
50
144
|
internally by the `shopify_api` gem, using the `ShopifyAPI::Context.embedded_app` setting.
|
51
|
-
-
|
52
|
-
the documentation for addressing these breaking changes on GitHub [here](https://github.com/Shopify/shopify-api-ruby#breaking-change-notice-for-version-1000).
|
145
|
+
- [Follow the guidance for upgrading `shopify-api-ruby`](https://github.com/Shopify/shopify-api-ruby#breaking-change-notice-for-version-1000).
|
53
146
|
|
54
147
|
### Specific cases
|
55
148
|
|
56
|
-
#### Shopify user
|
149
|
+
#### Shopify user ID in session
|
57
150
|
|
58
151
|
Previously, we set the entire app user object in the `session` object.
|
59
152
|
As of v19, since we no longer save the app user to the session (but only the shopify user id), we now store it as `session[:shopify_user_id]`. Please make sure to update any references to that object.
|
60
153
|
|
61
154
|
#### Webhook Jobs
|
62
155
|
|
156
|
+
It is assumed that you have an ActiveJob implementation configured for `perform_later`, e.g. Sidekiq.
|
157
|
+
Ensure your jobs inherit from `ApplicationJob` or `ActiveJob::Base`.
|
158
|
+
|
63
159
|
Add a new `handle` method to existing webhook jobs to go through the updated `shopify_api` gem.
|
64
160
|
|
65
161
|
```ruby
|
@@ -95,32 +191,7 @@ Shopify API session, or `nil` if no such session is available.
|
|
95
191
|
|
96
192
|
#### Setting up `ShopifyAPI::Context`
|
97
193
|
|
98
|
-
The `shopify_app` initializer must configure the `ShopifyAPI::Context`. The Rails generator will
|
99
|
-
generate a block in the `shopify_app` initializer. To do so manually, ensure the following is
|
100
|
-
part of the `after_initialize` block in `shopify_app.rb`.
|
101
|
-
|
102
|
-
```ruby
|
103
|
-
Rails.application.config.after_initialize do
|
104
|
-
if ShopifyApp.configuration.api_key.present? && ShopifyApp.configuration.secret.present?
|
105
|
-
ShopifyAPI::Context.setup(
|
106
|
-
api_key: ShopifyApp.configuration.api_key,
|
107
|
-
api_secret_key: ShopifyApp.configuration.secret,
|
108
|
-
old_api_secret_key: ShopifyApp.configuration.old_secret,
|
109
|
-
api_version: ShopifyApp.configuration.api_version,
|
110
|
-
host_name: URI(ENV.fetch('HOST', '')).host || '',
|
111
|
-
scope: ShopifyApp.configuration.scope,
|
112
|
-
is_private: !ENV.fetch('SHOPIFY_APP_PRIVATE_SHOP', '').empty?,
|
113
|
-
is_embedded: ShopifyApp.configuration.embedded_app,
|
114
|
-
session_storage: ShopifyApp::SessionRepository,
|
115
|
-
logger: Rails.logger,
|
116
|
-
private_shop: ENV.fetch('SHOPIFY_APP_PRIVATE_SHOP', nil),
|
117
|
-
user_agent_prefix: "ShopifyApp/#{ShopifyApp::VERSION}"
|
118
|
-
)
|
119
|
-
|
120
|
-
ShopifyApp::WebhooksManager.add_registrations
|
121
|
-
end
|
122
|
-
end
|
123
|
-
```
|
194
|
+
The `shopify_app` initializer must configure the `ShopifyAPI::Context`. The Rails generator will generate a block in the `shopify_app` initializer. To do so manually, you can refer to `after_initialize` block in the [template](https://github.com/Shopify/shopify_app/blob/main/lib/generators/shopify_app/install/templates/shopify_app.rb.tt).
|
124
195
|
|
125
196
|
## Upgrading to `v18.1.2`
|
126
197
|
|
@@ -128,7 +199,7 @@ Version 18.1.2 replaces the deprecated EASDK redirect with an App Bridge 2 redir
|
|
128
199
|
|
129
200
|
## Upgrading to `v17.2.0`
|
130
201
|
|
131
|
-
### Different SameSite cookie attribute
|
202
|
+
### Different SameSite cookie attribute behavior
|
132
203
|
|
133
204
|
To support Rails `v6.1`, the [`SameSiteCookieMiddleware`](/lib/shopify_app/middleware/same_site_cookie_middleware.rb) was updated to configure cookies to `SameSite=None` if the app is embedded. Before this release, cookies were configured to `SameSite=None` only if this attribute had not previously been set before.
|
134
205
|
|