shopify_app 13.2.0 → 20.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
  4. data/.github/ISSUE_TEMPLATE/config.yml +1 -0
  5. data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  7. data/.github/workflows/build.yml +40 -0
  8. data/.github/workflows/cla.yml +22 -0
  9. data/.github/workflows/close-waiting-for-response-issues.yml +20 -0
  10. data/.github/workflows/release.yml +24 -0
  11. data/.github/workflows/remove-labels-on-activity.yml +16 -0
  12. data/.github/workflows/rubocop.yml +22 -0
  13. data/.github/workflows/stale.yml +31 -0
  14. data/.gitignore +1 -2
  15. data/.nvmrc +1 -1
  16. data/.rubocop.yml +2 -0
  17. data/.ruby-version +1 -1
  18. data/CHANGELOG.md +221 -0
  19. data/CONTRIBUTING.md +81 -0
  20. data/Gemfile +5 -2
  21. data/Gemfile.lock +248 -0
  22. data/README.md +74 -563
  23. data/Rakefile +4 -3
  24. data/SECURITY.md +59 -0
  25. data/app/assets/images/storage_access.svg +1 -2
  26. data/app/assets/javascripts/shopify_app/app_bridge_3.1.1.js +10 -0
  27. data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +22 -0
  28. data/app/assets/javascripts/shopify_app/app_bridge_utils_3.1.1.js +1 -0
  29. data/app/assets/javascripts/shopify_app/post_redirect.js +9 -0
  30. data/app/assets/javascripts/shopify_app/redirect.js +10 -14
  31. data/app/assets/javascripts/shopify_app/storage_access.js +5 -10
  32. data/app/assets/javascripts/shopify_app/top_level_interaction.js +1 -1
  33. data/app/controllers/concerns/shopify_app/authenticated.rb +4 -0
  34. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +39 -0
  35. data/app/controllers/concerns/shopify_app/require_known_shop.rb +48 -0
  36. data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +40 -0
  37. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  38. data/app/controllers/shopify_app/callback_controller.rb +56 -77
  39. data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
  40. data/app/controllers/shopify_app/sessions_controller.rb +33 -117
  41. data/app/controllers/shopify_app/webhooks_controller.rb +5 -26
  42. data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
  43. data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
  44. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
  45. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  46. data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
  47. data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
  48. data/app/views/shopify_app/sessions/enable_cookies.html.erb +2 -7
  49. data/app/views/shopify_app/sessions/new.html.erb +38 -110
  50. data/app/views/shopify_app/sessions/request_storage_access.html.erb +12 -12
  51. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +21 -22
  52. data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +13 -0
  53. data/app/views/shopify_app/shared/redirect.html.erb +2 -2
  54. data/config/locales/de.yml +11 -11
  55. data/config/locales/ja.yml +4 -4
  56. data/config/locales/nl.yml +2 -2
  57. data/config/locales/th.yml +4 -4
  58. data/config/locales/vi.yml +22 -0
  59. data/config/locales/zh-CN.yml +2 -2
  60. data/config/routes.rb +20 -12
  61. data/docs/Quickstart.md +19 -83
  62. data/docs/Releasing.md +18 -15
  63. data/docs/Troubleshooting.md +140 -5
  64. data/docs/Upgrading.md +247 -0
  65. data/docs/shopify_app/authentication.md +128 -0
  66. data/docs/shopify_app/content-security-policy.md +10 -0
  67. data/docs/shopify_app/engine.md +82 -0
  68. data/docs/shopify_app/generators.md +127 -0
  69. data/docs/shopify_app/handling-access-scopes-changes.md +24 -0
  70. data/docs/shopify_app/script-tags.md +28 -0
  71. data/docs/shopify_app/session-repository.md +88 -0
  72. data/docs/shopify_app/testing.md +38 -0
  73. data/docs/shopify_app/webhooks.md +72 -0
  74. data/karma.conf.js +1 -1
  75. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +10 -9
  76. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  77. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +4 -3
  78. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +15 -14
  79. data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +9 -1
  80. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +7 -6
  81. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +2 -1
  82. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +1 -1
  83. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +4 -4
  84. data/lib/generators/shopify_app/controllers/controllers_generator.rb +5 -4
  85. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +27 -4
  86. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +12 -2
  87. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +74 -16
  88. data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +16 -0
  89. data/lib/generators/shopify_app/install/install_generator.rb +52 -40
  90. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +5 -2
  91. data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
  92. data/lib/generators/shopify_app/install/templates/session_store.rb +2 -1
  93. data/lib/generators/shopify_app/install/templates/shopify_app.js +1 -1
  94. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +43 -5
  95. data/lib/generators/shopify_app/install/templates/shopify_app_importmap.js +13 -0
  96. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
  97. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
  98. data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +4 -4
  99. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -0
  100. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +1 -1
  101. data/lib/generators/shopify_app/routes/routes_generator.rb +6 -5
  102. data/lib/generators/shopify_app/routes/templates/routes.rb +5 -5
  103. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +35 -7
  104. data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
  105. data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
  106. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  107. data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
  108. data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
  109. data/lib/generators/shopify_app/user_model/user_model_generator.rb +35 -7
  110. data/lib/generators/shopify_app/views/views_generator.rb +5 -4
  111. data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
  112. data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
  113. data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
  114. data/lib/shopify_app/configuration.rb +58 -11
  115. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +4 -4
  116. data/lib/shopify_app/controller_concerns/csrf_protection.rb +16 -0
  117. data/lib/shopify_app/controller_concerns/embedded_app.rb +6 -3
  118. data/lib/shopify_app/controller_concerns/ensure_billing.rb +243 -0
  119. data/lib/shopify_app/controller_concerns/frame_ancestors.rb +16 -0
  120. data/lib/shopify_app/controller_concerns/itp.rb +3 -3
  121. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  122. data/lib/shopify_app/controller_concerns/login_protection.rb +105 -90
  123. data/lib/shopify_app/controller_concerns/payload_verification.rb +25 -0
  124. data/lib/shopify_app/controller_concerns/redirect_for_embedded.rb +36 -0
  125. data/lib/shopify_app/controller_concerns/sanitized_params.rb +36 -0
  126. data/lib/shopify_app/controller_concerns/webhook_verification.rb +3 -18
  127. data/lib/shopify_app/engine.rb +26 -11
  128. data/lib/shopify_app/errors.rb +34 -0
  129. data/lib/shopify_app/jobs/scripttags_manager_job.rb +2 -2
  130. data/lib/shopify_app/jobs/webhooks_manager_job.rb +4 -5
  131. data/lib/shopify_app/managers/scripttags_manager.rb +12 -6
  132. data/lib/shopify_app/managers/webhooks_manager.rb +62 -42
  133. data/lib/shopify_app/middleware/jwt_middleware.rb +6 -3
  134. data/lib/shopify_app/session/in_memory_session_store.rb +2 -3
  135. data/lib/shopify_app/session/in_memory_shop_session_store.rb +10 -7
  136. data/lib/shopify_app/session/in_memory_user_session_store.rb +10 -7
  137. data/lib/shopify_app/session/jwt.rb +19 -16
  138. data/lib/shopify_app/session/null_user_session_store.rb +2 -1
  139. data/lib/shopify_app/session/session_repository.rb +40 -2
  140. data/lib/shopify_app/session/session_storage.rb +4 -6
  141. data/lib/shopify_app/session/shop_session_storage.rb +6 -6
  142. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +57 -0
  143. data/lib/shopify_app/session/user_session_storage.rb +20 -7
  144. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +71 -0
  145. data/lib/shopify_app/test_helpers/all.rb +2 -1
  146. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +4 -3
  147. data/lib/shopify_app/utils.rb +14 -7
  148. data/lib/shopify_app/version.rb +2 -1
  149. data/lib/shopify_app.rb +52 -29
  150. data/package.json +7 -8
  151. data/service.yml +1 -5
  152. data/shopify_app.gemspec +22 -20
  153. data/translation.yml +1 -1
  154. data/yarn.lock +2173 -2206
  155. metadata +110 -56
  156. data/.github/ISSUE_TEMPLATE.md +0 -14
  157. data/.github/probots.yml +0 -2
  158. data/.travis.yml +0 -28
  159. data/config/locales/hi.yml +0 -23
  160. data/config/locales/ms.yml +0 -22
  161. data/docs/install-on-dev-shop.png +0 -0
  162. data/docs/test-your-app.png +0 -0
  163. data/lib/generators/shopify_app/install/templates/omniauth.rb +0 -3
  164. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +0 -20
  165. data/lib/generators/shopify_app/install/templates/user_agent.rb +0 -6
  166. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +0 -34
  167. data/package-lock.json +0 -7245
data/README.md CHANGED
@@ -1,623 +1,134 @@
1
- Shopify App
2
- ===========
3
- [![Version][gem]][gem_url] [![Build Status](https://travis-ci.org/Shopify/shopify_app.png)](https://travis-ci.org/Shopify/shopify_app)
1
+ # Shopify App
2
+
3
+ [![Version][gem]][gem_url] [![Build Status](https://github.com/Shopify/shopify_app/workflows/CI/badge.svg)](https://github.com/Shopify/shopify_app/actions?query=workflow%3ACI)
4
4
 
5
5
  [gem]: https://img.shields.io/gem/v/shopify_app.svg
6
6
  [gem_url]: https://rubygems.org/gems/shopify_app
7
7
 
8
+ This gem builds Rails applications that can be embedded in the Shopify Admin.
8
9
 
9
- Shopify Application Rails engine and generator
10
+ [Introduction](#introduction) |
11
+ [Requirements](#requirements) |
12
+ [Usage](#usage) |
13
+ [Documentation](#documentation) |
14
+ [Contributing](/CONTRIBUTING.md) |
15
+ [License](/LICENSE)
10
16
 
11
- #### NOTE: Versions 8.0.0 through 8.2.3 contained a CSRF vulnerability that was addressed in version 8.2.4. Please update to version 8.2.4 if you're using an old version.
12
17
 
13
- Table of Contents
14
- -----------------
15
- - [Introduction](#introduction)
16
- - [Become a Shopify App Developer](#become-a-shopify-app-developer)
17
- - [Installation](#installation)
18
- - [Generators](#generators)
19
- - [Mounting the Engine](#mounting-the-engine)
20
- - [Authentication](#authentication)
21
- - [WebhooksManager](#webhooksmanager)
22
- - [ScripttagsManager](#scripttagsmanager)
23
- - [RotateShopifyTokenJob](#rotateshopifytokenjob)
24
- - [App Tunneling](#app-tunneling)
25
- - [AppProxyVerification](#appproxyverification)
26
- - [Troubleshooting](#troubleshooting)
27
- - [Testing an embedded app outside the Shopify admin](#testing-an-embedded-app-outside-the-shopify-admin)
28
- - [Migration to 13.0.0](#migrating-to-1300)
29
- - [Questions or problems?](#questions-or-problems-)
30
- - [Rails 6 Compatibility](#rails-6-compatibility)
31
- - [Upgrading from 8.6 to 9.0.0](#upgrading-from-86-to-900)
18
+ ## Introduction
32
19
 
33
- Introduction
34
- -----------
35
- Get started with the [Shopify Admin API](https://help.shopify.com/en/api/getting-started) faster; This gem includes a Rails Engine and generators for writing Rails applications using the Shopify API. The Engine provides a SessionsController and all the required code for authenticating with a shop via Oauth (other authentication methods are not supported).
20
+ This gem includes a Rails engine, generators, modules, and mixins that help create Rails applications that work with Shopify APIs. The [Shopify App Rails engine](/docs/shopify_app/engine.md) provides all the code required to implement OAuth with Shopify. The [default Shopify App generator](/docs/shopify_app/generators.md#-environment-rails-generate-shopify_app) builds an app that can be embedded in the Shopify Admin and secures it with [session tokens](https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens).
36
21
 
37
- *Note: It's recommended to use this on a new Rails project so that the generator won't overwrite/delete your files.*
22
+ <!-- This section is linked to in `templates/shopify_app.rb.tt`. Be careful renaming this heading. -->
23
+ ## Requirements
38
24
 
39
- Learn how to create and deploy a new Shopify App to Heroku with our [quickstart guide](https://github.com/Shopify/shopify_app/blob/master/docs/Quickstart.md), or dive in in less than 5 minutes with this quickstart video:
25
+ > **Rails compatibility**
26
+ > * Use Shopify App `<= v7.2.8` if you need to work with Rails 4.
40
27
 
41
- [https://www.youtube.com/watch?v=yGxeoAHlQOg](https://www.youtube.com/watch?v=yGxeoAHlQOg)
28
+ To become a Shopify app developer, you will need a [Shopify Partners](https://www.shopify.com/partners) account. Explore the [Shopify dev docs](https://shopify.dev/concepts/shopify-introduction) to learn more about [building Shopify apps](https://shopify.dev/concepts/apps).
42
29
 
43
- Become a Shopify App Developer
44
- --------------------------------
45
- To become a Shopify App Developer, you'll need a [Shopify Partner account.](http://shopify.com/partners) If you don't have a Shopify Partner account, head to http://shopify.com/partners to create one before you start.
30
+ This gem requires that you have the following credentials:
46
31
 
47
- Once you have a Partner account, [create a new application in the Partner Dashboard](https://help.shopify.com/en/api/tools/partner-dashboard/your-apps) to get an API key and other API credentials.
32
+ - **Shopify API key:** The API key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
33
+ - **Shopify API secret:** The API secret key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
48
34
 
49
- To create an application for development set your new app's `App URL` to the URL provided by [your tunnel](#app-tunneling), ensuring that you use `https://`. If you are not planning to embed your app inside the Shopify admin or receive webhooks, set your redirect URL to `http://localhost:3000/` and the `Whitelisted redirection URL(s)` to contain `<App URL>/auth/shopify/callback`.
35
+ ## Usage
50
36
 
51
- Installation
52
- ------------
53
- To get started, add `shopify_app` to your Gemfile and run `bundle install`:
37
+ 1. To get started, create a new Rails app:
54
38
 
55
39
  ``` sh
56
- # Create a new rails app
57
- $ rails new my_shopify_app
58
- $ cd my_shopify_app
59
-
60
- # Add the gem shopify_app to your Gemfile
61
- $ echo "gem 'shopify_app'" >> Gemfile
62
- $ bundle install
40
+ rails new my_shopify_app
63
41
  ```
64
42
 
65
- Now we are ready to run any of the [generators](#generators) included with `shopify_app`. The following section explains the generators and what you can do with them.
66
-
67
-
68
- #### Rails Compatibility
69
-
70
- The latest version of shopify_app is compatible with Rails `>= 5`. Use version `<= v7.2.8` if you need to work with Rails 4.
71
-
72
-
73
- Generators
74
- ----------
75
-
76
- ### Default Generator
77
-
78
- The default generator will run the `install`, `shop`, and `home_controller` generators. This is the recommended way to start a new app from scratch:
43
+ 2. Add the Shopify App gem to `my_shopify_app`'s Gemfile.
79
44
 
80
45
  ```sh
81
- $ rails generate shopify_app
46
+ bundle add shopify_app
82
47
  ```
83
48
 
84
- After running the generator, you will need to run `rails db:migrate` to add new tables to your database. You can start your app with `bundle exec rails server` and install your app by visiting `http://localhost` in your web browser.
85
-
86
- ### API Keys
87
-
88
- The default and install generators have been updated to source Shopify API key and secret from an Environment (`.env`) variables file, which you will need to create with the following format:
89
-
90
- ```
91
- SHOPIFY_API_KEY=your api key
92
- SHOPIFY_API_SECRET=your api secret
93
- ```
94
-
95
- These values can be found on the "App Setup" page in the [Shopify Partners Dashboard][dashboard]. If you are checking your code into a code repository, ensure your `.gitignore` prevents your `.env` file from being checked into any publicly accessible code.
96
-
97
- **You will need to load the ENV variables into your environment, you can do this with the [dot-env](https://github.com/bkeepers/dotenv) gem or any other method you wish to.**
98
-
99
- ### Install Generator
49
+ 3. Create a `.env` file in the root of `my_shopify_app` to specify your Shopify API credentials:
100
50
 
101
51
  ```sh
102
- $ rails generate shopify_app:install
103
-
104
- # or optionally with arguments:
105
-
106
- $ rails generate shopify_app:install
52
+ SHOPIFY_API_KEY=<Your Shopify API key>
53
+ SHOPIFY_API_SECRET=<Your Shopify API secret>
107
54
  ```
108
55
 
109
- Other options include:
110
- * `application_name` - the name of your app, it can be supplied with or without double-quotes if a whitespace is present. (e.g. `--application_name Example App` or `--application_name "Example App"`)
111
- * `scope` - the Oauth access scope required for your app, e.g. **read_products, write_orders**. *Multiple options* need to be delimited by a comma-space and can be supplied with or without double-quotes
112
- (e.g. `--scope read_products, write_orders, write_products` or `--scope "read_products, write_orders, write_products"`)
113
- For more information, refer the [docs](http://docs.shopify.com/api/tutorials/oauth).
114
- * `embedded` - the default is to generate an [embedded app](http://docs.shopify.com/embedded-app-sdk), if you want a legacy non-embedded app then set this to false, `--embedded false`
115
-
116
- You can update any of these settings later on easily; the arguments are simply for convenience.
117
-
118
- The generator adds ShopifyApp and the required initializers to the host Rails application.
119
-
120
- After running the `install` generator, you can start your app with `bundle exec rails server` and install your app by visiting localhost.
121
-
56
+ > In a development environment, you can use a gem like `dotenv-rails` to manage environment variables.
122
57
 
123
- ### Home Controller Generator
58
+ 4. Run the default Shopify App generator to create an app that can be embedded in the Shopify Admin:
124
59
 
125
60
  ```sh
126
- $ rails generate shopify_app:home_controller
127
- ```
128
-
129
- This generator creates an example home controller and view which fetches and displays products using the Shopify API.
130
-
131
-
132
- ### App Proxy Controller Generator
133
-
134
- ```sh
135
- $ rails generate shopify_app:app_proxy_controller
136
- ```
137
-
138
- This optional generator, not included with the default generator, creates the app proxy controller to handle proxy requests to the app from your shop storefront, modifies 'config/routes.rb' with a namespace route, and an example view which displays current shop information using the LiquidAPI.
139
-
140
- ### Marketing Extension Generator
141
-
142
- ```sh
143
- $ rails generate shopify_app:add_marketing_activity_extension
144
- ```
145
-
146
- This will create a controller with the endpoints required to build a [marketing activities extension](https://help.shopify.com/en/api/embedded-apps/app-extensions/shopify-admin/marketing-activities). The extension will be generated with a base url at `/marketing_activities`, which should also be configured in partners.
147
-
148
- ### Controllers, Routes and Views
149
-
150
- The last group of generators are for your convenience if you want to start overriding code included as part of the Rails engine. For example, by default the engine provides a simple SessionController, if you run the `rails generate shopify_app:controllers` generator then this code gets copied out into your app so you can start adding to it. Routes and views follow the exact same pattern.
151
-
152
- Mounting the Engine
153
- -------------------
154
-
155
- Mounting the Engine will provide the basic routes to authenticating a shop with your application. By default it will provide:
156
-
157
- | Verb | Route | Action |
158
- |--------|-------------------------------|------------------------------|
159
- |GET |'/login' |Login |
160
- |POST |'/login' |Login |
161
- |GET |'/auth/shopify/callback' |Authenticate Callback |
162
- |GET |'/logout' |Logout |
163
- |POST |'/webhooks/:type' |Webhook Callback |
164
-
165
- ### Nested Routes
166
-
167
- The engine may also be mounted at a nested route, for example:
168
-
169
- ```ruby
170
- mount ShopifyApp::Engine, at: '/nested'
171
- ```
172
-
173
- This will create the Shopify engine routes under the specified subpath. You'll also need to make some updates to your `shopify_app.rb` and `omniauth.rb` initializers. First, update the shopify_app initializer to include a custom `root_url` e.g.:
174
-
175
- ```ruby
176
- ShopifyApp.configure do |config|
177
- config.root_url = '/nested'
178
- end
179
- ```
180
-
181
- then update the omniauth initializer to include a custom `callback_path` e.g.:
182
-
183
- ```ruby
184
- provider :shopify,
185
- ShopifyApp.configuration.api_key,
186
- ShopifyApp.configuration.secret,
187
- scope: ShopifyApp.configuration.scope,
188
- callback_path: '/nested/auth/shopify/callback'
189
- ```
190
-
191
- You may also need to change your `config/routes.rb` to render a view for `/nested`, since this is what will be rendered in the Shopify Admin of any shops that have installed your app. The engine itself doesn't have a view for this, so you'll need something like this:
192
-
193
- ```ruby
194
- # config/routes.rb
195
- Rails.application.routes.draw do
196
- root :to => 'something_else#index'
197
- get "/nested", to: "home#index"
198
- mount ShopifyApp::Engine, at: '/nested'
199
- end
200
- ```
201
-
202
- Finally, note that if you do this, to add your app to a store, you must navigate to `/nested` in order to render the `Enter your shop domain to log in or install this app.` UI.
203
-
204
- ### Custom login URL
205
-
206
- While you can customize the login view by creating a `/app/views/shopify_app/sessions/new.html.erb` file, you may also want to customize the URL entirely. You can modify your `shopify_app.rb` initializer to provide a custom `login_url` e.g.:
207
-
208
- ```ruby
209
- ShopifyApp.configure do |config|
210
- config.login_url = 'https://my.domain.com/nested/login'
211
- end
212
- ```
213
-
214
- Authentication
215
- --------------
216
-
217
- ### Callback
218
-
219
- Upon completing the authentication flow, Shopify calls the app at the `callback_path` mentioned before. If the app needs to do some extra work, it can define and configure the route to a custom callback controller, inheriting from `ShopifyApp::CallbackController` and hook into or override any of the defined helper methods. The default callback controller already provides the following behaviour:
220
- * Logging into the shop and resetting the session
221
- * [Installing Webhooks](https://github.com/Shopify/shopify_app#webhooksmanager)
222
- * [Setting Scripttags](https://github.com/Shopify/shopify_app#scripttagsmanager)
223
- * [Performing the AfterAuthenticate Job](https://github.com/Shopify/shopify_app#afterauthenticatejob)
224
- * Redirecting to the return address
225
-
226
- **Note that starting with version 8.4.0, we have extracted the callback logic in its own controller. If you are upgrading from a version older than 8.4.0 the callback action and related helper methods were defined in `ShopifyApp::SessionsController` ==> you will have to extend `ShopifyApp::CallbackController` instead and port your logic to the new controller.**
227
-
228
- ### ShopifyApp::SessionRepository
229
-
230
- `ShopifyApp::SessionRepository` allows you as a developer to define how your sessions are stored and retrieved for shops. The `SessionRepository` is configured in the `config/initializers/shopify_app.rb` file and can be set to any object that implements `self.store(auth_session, *args)` which stores the session and returns a unique identifier and `self.retrieve(id)` which returns a `ShopifyAPI::Session` for the passed id. These methods are already implemented as part of the `ShopifyApp::SessionStorage` concern but can be overridden for custom implementation.
231
-
232
- #### Shop-based token storage
233
- Storing tokens on the store model means that any user login associated with the store will have equal access levels to whatever the original user granted the app.
234
- ```sh
235
- $ rails generate shopify_app:shop_model
236
- ```
237
- This will generate a shop model which will be the storage for the tokens necessary for authentication.
238
-
239
- #### User-based token storage
240
- A more granular control over the level of access per user on an app might be necessary, to which the shop-based token strategy is not sufficient. Shopify supports a user-based token storage strategy where a unique token to each user can be managed. Shop tokens must still be maintained if you are running background jobs so that you can make use of them when necessary.
241
- ```sh
242
- $ rails generate shopify_app:shop_model
243
- $ rails generate shopify_app:user_model
244
- ```
245
- This will generate a shop model and user model, which will be the storage for the tokens necessary for authentication.
246
-
247
- The current Shopify user will be stored in the rails session at `session[:shopify_user]`
248
-
249
- Read more about Online vs. Offline access [here](https://help.shopify.com/api/getting-started/authentication/oauth).
250
-
251
- #### Migrating from shop-based to user-based token strategy
252
- 1. Run the `user_model` generator as mentioned above.
253
- 2. Ensure that both your `Shop` model and `User` model includes the necessary concerns `ShopifyApp::ShopSessionStorage` and `ShopifyApp::UserSessionStorage`.
254
- 3. Make changes to 2 initializer files as shown below:
255
- ```ruby
256
- # In the `omniauth.rb` initializer:
257
- provider :shopify,
258
- ...
259
- setup: lambda { |env|
260
- ...
261
- # Add this line
262
- strategy.options[:per_user_permissions] = strategy.session[:user_tokens]
263
- ...
264
- }
265
-
266
- # In the `shopify_app.rb` initializer:
267
- config.shop_session_repository = {YOUR_SHOP_MODEL_CLASS}
268
- config.user_session_repository = {YOUR_USER_MODEL_CLASS}
269
- ```
270
-
271
- ### Authenticated
272
-
273
- The engine provides a `ShopifyApp::Authenticated` concern which should be included in any controller that is intended to be behind Shopify OAuth. It adds `before_action`s to ensure that the user is authenticated and will redirect to the Shopify login page if not. It is best practice to include this concern in a base controller inheriting from your `ApplicationController`, from which all controllers that require Shopify authentication inherit.
274
-
275
- For backwards compatibility, the engine still provides a controller called `ShopifyApp::AuthenticatedController` which includes the `ShopifyApp::Authenticated` concern. Note that it inherits directly from `ActionController::Base`, so you will not be able to share functionality between it and your application's `ApplicationController`.
276
-
277
- ### AfterAuthenticate Job
278
-
279
- If your app needs to perform specific actions after the user is authenticated successfully (i.e. every time a new session is created), ShopifyApp can queue or run a job of your choosing (note that we already provide support for automatically creating Webhooks and Scripttags). To configure the after authenticate job, update your initializer as follows:
280
-
281
- ```ruby
282
- ShopifyApp.configure do |config|
283
- config.after_authenticate_job = { job: "Shopify::AfterAuthenticateJob" }
284
- end
285
- ```
286
-
287
- The job can be configured as either a class or a class name string.
288
-
289
- If you need the job to run synchronously add the `inline` flag:
290
-
291
- ```ruby
292
- ShopifyApp.configure do |config|
293
- config.after_authenticate_job = { job: Shopify::AfterAuthenticateJob, inline: true }
294
- end
295
- ```
296
-
297
- We've also provided a generator which creates a skeleton job and updates the initializer for you:
298
-
299
- ```
300
- bin/rails g shopify_app:add_after_authenticate_job
301
- ```
302
-
303
- If you want to perform that action only once, e.g. send a welcome email to the user when they install the app, you should make sure that this action is idempotent, meaning that it won't have an impact if run multiple times.
304
-
305
- API Versioning
306
- --------------
307
-
308
- Shopify's API is versioned, and you can [read about that process in the Shopify Developers documentation page](https://shopify.dev/concepts/about-apis/versioning).
309
-
310
- Since shopify_app gem version 1.11.0, the included shopify_api gem has also been updated to allow you to easily set and switch what version of the Shopify API you want your app or service to use, as well as surface warnings to Rails apps about [deprecated endpoints, GraphQL fields and more](https://shopify.dev/concepts/about-apis/versioning#deprecation-practices).
311
-
312
- See the [shopify_api gem README](https://github.com/Shopify/shopify_api/) for more details.
313
-
314
- WebhooksManager
315
- ---------------
316
-
317
- ShopifyApp can manage your app's webhooks for you if you set which webhooks you require in the initializer:
318
-
319
- ```ruby
320
- ShopifyApp.configure do |config|
321
- config.webhooks = [
322
- {topic: 'carts/update', address: 'https://example-app.com/webhooks/carts_update'}
323
- ]
324
- end
61
+ rails generate shopify_app
325
62
  ```
326
63
 
327
- When the oauth callback is completed successfully, ShopifyApp will queue a background job which will ensure all the specified webhooks exist for that shop. Because this runs on every oauth callback, it means your app will always have the webhooks it needs even if the user uninstalls and re-installs the app.
328
-
329
- ShopifyApp also provides a WebhooksController that receives webhooks and queues a job based on the received topic. For example, if you register the webhook from above, then all you need to do is create a job called `CartsUpdateJob`. The job will be queued with 2 params: `shop_domain` and `webhook` (which is the webhook body).
330
-
331
- If you would like to namespace your jobs, you may set `webhook_jobs_namespace` in the config. For example, if your app handles webhooks from other ecommerce applications as well, and you want Shopify cart update webhooks to be processed by a job living in `jobs/shopify/webhooks/carts_update_job.rb` rather than `jobs/carts_update_job.rb`):
332
-
333
- ```ruby
334
- ShopifyApp.configure do |config|
335
- config.webhook_jobs_namespace = 'shopify/webhooks'
336
- end
337
- ```
338
-
339
- If you are only interested in particular fields, you can optionally filter the data sent by Shopify by specifying the `fields` parameter in `config/webhooks`. Note that you will still receive a webhook request from Shopify every time the resource is updated, but only the specified fields will be sent.
340
-
341
- ```ruby
342
- ShopifyApp.configure do |config|
343
- config.webhooks = [
344
- {topic: 'products/update', address: 'https://example-app.com/webhooks/products_update', fields: ['title', 'vendor']}
345
- ]
346
- end
347
- ```
348
-
349
- If you'd rather implement your own controller then you'll want to use the WebhookVerification module to verify your webhooks, example:
350
-
351
- ```ruby
352
- class CustomWebhooksController < ApplicationController
353
- include ShopifyApp::WebhookVerification
354
-
355
- def carts_update
356
- params.permit!
357
- SomeJob.perform_later(shop_domain: shop_domain, webhook: webhook_params.to_h)
358
- head :no_content
359
- end
360
-
361
- private
362
-
363
- def webhook_params
364
- params.except(:controller, :action, :type)
365
- end
366
- end
367
- ```
368
-
369
- The module skips the `verify_authenticity_token` before_action and adds an action to verify that the webhook came from Shopify. You can now add a post route to your application, pointing to the controller and action to accept the webhook data from Shopify.
370
-
371
- The WebhooksManager uses ActiveJob. If ActiveJob is not configured then by default Rails will run the jobs inline. However, it is highly recommended to configure a proper background processing queue like sidekiq or resque in production.
372
-
373
- ShopifyApp can create webhooks for you using the `add_webhook` generator. This will add the new webhook to your config and create the required job class for you.
374
-
375
- ```
376
- rails g shopify_app:add_webhook -t carts/update -a https://example.com/webhooks/carts_update
377
- ```
378
-
379
- Where `-t` is the topic and `-a` is the address the webhook should be sent to.
380
-
381
- ScripttagsManager
382
- -----------------
383
-
384
- As with webhooks, ShopifyApp can manage your app's scripttags for you by setting which scripttags you require in the initializer:
385
-
386
- ```ruby
387
- ShopifyApp.configure do |config|
388
- config.scripttags = [
389
- {event:'onload', src: 'https://my-shopifyapp.herokuapp.com/fancy.js'},
390
- {event:'onload', src: ->(domain) { dynamic_tag_url(domain) } }
391
- ]
392
- end
393
- ```
394
-
395
- You also need to have write_script_tags permission in the config scope in order to add script tags automatically:
396
-
397
- ```ruby
398
- config.scope = '... , write_script_tags'
399
- ```
400
-
401
- Scripttags are created in the same way as the Webhooks, with a background job which will create the required scripttags.
402
-
403
- If `src` responds to `call` its return value will be used as the scripttag's source. It will be called on scripttag creation and deletion.
404
-
405
- RotateShopifyTokenJob
406
- ---------------------
407
-
408
- If your Shopify secret key is leaked, you can use the RotateShopifyTokenJob to perform [API Credential Rotation](https://help.shopify.com/en/api/getting-started/authentication/oauth/api-credential-rotation).
409
-
410
- Before running the job, you'll need to generate a new secret key from your Shopify Partner dashboard, and update the `/config/initializers/shopify_app.rb` to hold your new and old secret keys:
411
-
412
- ```ruby
413
- config.secret = Rails.application.secrets.shopify_secret
414
- config.old_secret = Rails.application.secrets.old_shopify_secret
415
- ```
416
-
417
- We've provided a generator which creates the job and an example rake task:
64
+ 5. Run a migration to create the necessary tables in your database:
418
65
 
419
66
  ```sh
420
- bin/rails g shopify_app:rotate_shopify_token_job
421
- ```
422
-
423
- The generated rake task will be found at `lib/tasks/shopify/rotate_shopify_token.rake` and is provided strictly for example purposes. It might not work with your application out of the box without some configuration.
424
-
425
- ⚠️ Note: if you are updating `shopify_app` from a version prior to 8.4.2 (and do not wish to run the default/install generator again), you will need to add [the following line](https://github.com/Shopify/shopify_app/blob/4f7e6cca2a472d8f7af44b938bd0fcafe4d8e88a/lib/generators/shopify_app/install/templates/shopify_provider.rb#L18) to `config/intializers/omniauth.rb`:
426
-
427
- ```ruby
428
- strategy.options[:old_client_secret] = ShopifyApp.configuration.old_secret
67
+ rails db:migrate
429
68
  ```
430
69
 
431
- App Tunneling
432
- -------------
70
+ 6. Setup a SSH tunnel to allow the OAuth redirect to work. See how in the [Setup SSH tunnel for development](/docs/Quickstart.md#setup-ssh-tunnel-for-development) section in [Quickstart](/docs/Quickstart.md)
433
71
 
434
- 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](#app-proxy-controller-generator) or receive Webhooks.
435
-
436
- Use a tunneling service like [ngrok](https://ngrok.com/), [Forward](https://forwardhq.com/), [Beeceptor](https://beeceptor.com/), [Mockbin](http://mockbin.org/), or [Hookbin](https://hookbin.com/) to make your development environment accessible to the internet.
437
-
438
- For example with [ngrok](https://ngrok.com/), run this command to set up a tunnel proxy to Rails' default port:
72
+ 7. Run the app:
439
73
 
440
74
  ```sh
441
- ngrok http 3000
442
- ```
443
-
444
- AppProxyVerification
445
- --------------------
446
-
447
- The engine provides a mixin for verifying incoming HTTP requests sent via an App Proxy. Any controller that `include`s `ShopifyApp::AppProxyVerification` will verify that each request has a valid `signature` query parameter that is calculated using the other query parameters and the app's shared secret.
448
-
449
- ### Recommended Usage
450
-
451
- The App Proxy Controller Generator automatically adds the mixin to the generated app_proxy_controller.rb
452
- Additional controllers for resources within the App_Proxy namespace, will need to include the mixin like so:
453
-
454
- ```ruby
455
- # app/controllers/app_proxy/reviews_controller.rb
456
- class ReviewsController < ApplicationController
457
- include ShopifyApp::AppProxyVerification
458
- # ...
459
- end
460
- ```
461
-
462
- Create your app proxy url in the [Shopify Partners' Dashboard][dashboard], making sure to point it to `https://your_app_website.com/app_proxy`.
463
- ![Creating an App Proxy](/images/app-proxy-screenshot.png)
464
-
465
- App Bridge
466
- ---
467
-
468
- A basic example of using [App Bridge][app-bridge] is included in the install generator. An app instance is automatically initialized in [shopify_app.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/shopify_app.js) and [flash_messages.js](https://github.com/Shopify/shopify_app/blob/master/lib/generators/shopify_app/install/templates/flash_messages.js) converts Rails [flash messages](https://api.rubyonrails.org/classes/ActionDispatch/Flash.html) to App Bridge Toast actions automatically. 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). 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).
469
-
470
- Troubleshooting
471
- ---------------
472
-
473
- see [TROUBLESHOOTING.md](https://github.com/Shopify/shopify_app/blob/master/docs/Troubleshooting.md)
474
-
475
- Using Test Helpers inside your Application
476
- -----------------------------------------
477
-
478
- A test helper that will allow you to test `ShopifyApp::WebhookVerification` in the controller from your app, to use this test, you need to `require` it directly inside your app `test/controllers/webhook_verification_test.rb`.
479
-
480
- ```ruby
481
- require 'test_helper'
482
- require 'action_controller'
483
- require 'action_controller/base'
484
- require 'shopify_app/test_helpers/webhook_verification_helper'
485
- ```
486
-
487
- Or you can require in your `test/test_helper.rb`.
488
-
489
- ```ruby
490
- ENV['RAILS_ENV'] ||= 'test'
491
- require_relative '../config/environment'
492
- require 'rails/test_help'
493
- require 'byebug'
494
- require 'shopify_app/test_helpers/all'
495
- ```
496
-
497
- With `lib/shopify_app/test_helpers/all'` more tests can be added and will only need to be required in once in your library.
498
-
499
-
500
- Testing an embedded app outside the Shopify admin
501
- -------------------------------------------------
502
-
503
- By default, loading your embedded app will redirect to the Shopify admin, with the app view loaded in an `iframe`. If you need to load your app outside of the Shopify admin (e.g., for performance testing), you can change `forceRedirect: true` to `false` in `ShopifyApp.init` block in the `embedded_app` view. To keep the redirect on in production but off in your `development` and `test` environments, you can use:
504
-
505
- ```javascript
506
- forceRedirect: <%= Rails.env.development? || Rails.env.test? ? 'false' : 'true' %>
75
+ rails server
507
76
  ```
508
77
 
509
- Migrating to 13.0.0
510
- -------------------
511
-
512
- Version 13.0.0 adds the ability to use both user and shop sessions, concurrently. This however involved a large
513
- change to how session stores work. Here are the steps to migrate to 13.x
514
-
515
- ### Changes to `config/initializers/shopify_app.rb`
516
- - *REMOVE* `config.per_user_tokens = [true|false]` this is no longer needed
517
- - *CHANGE* `config.session_repository = 'Shop'` To `config.shop_session_repository = 'Shop'`
518
- - *ADD (optional)* User Session Storage `config.user_session_repository = 'User'`
519
-
520
- ### Shop Model Changes (normally `app/models/shop.rb`)
521
- - *CHANGE* `include ShopifyApp::SessionStorage` to `include ShopifyApp::ShopSessionStorage`
522
-
523
- ### Changes to the @shop_session instance variable (normally in `app/controllers/*.rb`)
524
- - *CHANGE* if you are using shop sessions, `@shop_session` will need to be changed to `@current_shopify_session`.
525
-
526
- ### Changes to Rails `session`
527
- - *CHANGE* `session[:shopify]` is no longer set. Use `session[:user_id]` if your app uses user based tokens, or `session[:shop_id]` if your app uses shop based tokens.
528
-
529
- ### Changes to `ShopifyApp::LoginProtection`
530
- `ShopifyApp::LoginProtection`
531
-
532
- if you are using `ShopifyApp::LoginProtection#shop_session` in your code, it will need to be
533
- changed to `ShopifyApp::LoginProtection#activate_shopify_session`
78
+ 8. Install the app by visiting the server's URL (e.g. http://127.0.0.1:3000) and specifying the subdomain of the shop where you want it to be installed to.
534
79
 
535
- ### Notes
536
- You do not need a user model; a shop session is fine for most applications.
80
+ 9. After the app is installed, you're redirected to the embedded app.
537
81
 
538
- Questions or problems?
539
- ----------------------
82
+ This app implements [OAuth 2.0](https://shopify.dev/tutorials/authenticate-with-oauth) with Shopify to authenticate requests made to Shopify APIs. By default, this app is configured to use [session tokens](https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens) to authenticate merchants when embedded in the Shopify Admin.
540
83
 
541
- - [Ask questions!](https://ecommerce.shopify.com/c/shopify-apis-and-technology)
542
- - [Read the docs!](https://help.shopify.com/api/guides)
543
- - And don't forget to check the [Changelog](https://github.com/Shopify/shopify_app/blob/master/CHANGELOG.md) too!
84
+ See [*Generators*](/docs/shopify_app/generators.md) for a complete list of generators available to Shopify App.
544
85
 
545
- Upgrading to 11.7.0
546
- ---------------------------
86
+ ## Documentation
547
87
 
548
- ### Session storage method signature breaking change
549
- If you override `def self.store(auth_session)` method in your session storage model (e.g. Shop), the method signature has changed to `def self.store(auth_session, *args)` in order to support user-based token storage. Please update your method signature to include the second argument.
88
+ You can find documentation on gem usage, concepts, mixins, installation, and more in [`/docs`](/docs).
550
89
 
551
- Rails 6 Compatibility
552
- ---------------------
90
+ * Start with the [*Generators*](/docs/shopify_app/generators.md) document to learn more about the generators this gem offers.
91
+ * Check out the [*Changelog*](/CHANGELOG.md) for notes on the latest gem releases.
92
+ * See [*Troubleshooting*](/docs/Troubleshooting.md) for tips on common issues.
93
+ * If you are looking to upgrade your Shopify App version to a new major release, see [*Upgrading*](/docs/Upgrading.md) for important notes on breaking changes.
553
94
 
554
- ### Disable Webpacker
555
- If you are using sprockets in rails 6 or want to generate a shopify_app without webpacker run the install task by running
95
+ ### Overview
556
96
 
557
- ```
558
- SHOPIFY_APP_DISABLE_WEBPACKER=1 rails generate shopify_app
559
- ```
97
+ [Quickstart](/docs/Quickstart.md)
560
98
 
561
- and then in your ShopifyApp configuration block, add
99
+ [Troubleshooting](/docs/Troubleshooting.md)
562
100
 
563
- ```
564
- ShopifyApp.configure do |config|
565
- config.disable_webpacker = true
566
- end
567
- ```
101
+ [Upgrading](/docs/Upgrading.md)
568
102
 
569
- Upgrading from 8.6 to 9.0.0
570
- ---------------------------
103
+ [Shopify App](/docs/shopify_app)
104
+ * [Authentication](/docs/shopify_app/authentication.md)
105
+ * [Engine](/docs/shopify_app/engine.md)
106
+ * [Generators](/docs/shopify_app/generators.md)
107
+ * [ScriptTags](/docs/shopify_app/script-tags.md)
108
+ * [Session repository](/docs/shopify_app/session-repository.md)
109
+ * [Handling changes in access scopes](/docs/shopify_app/handling-access-scopes-changes.md)
110
+ * [Testing](/docs/shopify_app/testing.md)
111
+ * [Webhooks](/docs/shopify_app/webhooks.md)
112
+ * [Content Security Policy](/docs/shopify_app/content-security-policy.md)
571
113
 
572
- ### Configuration change
114
+ ### Engine
573
115
 
574
- Add an api version configuration in `config/initializers/shopify_app.rb`
575
- Set this to the version you want to run against by default. See [Shopify API docs](https://help.shopify.com/en/api/versioning) for versions available.
576
- ```ruby
577
- config.api_version = '2019-04'
578
- ```
116
+ Mounting the Shopify App Rails Engine provides the following routes. These routes are configured to help install your application on shops and implement OAuth.
579
117
 
580
- ### Session storage change
118
+ | Verb | Route | Action |
119
+ | ---: | :--- | :--- |
120
+ | `GET` | `/login` | Login |
121
+ | `POST` | `/login` | Login |
122
+ | `GET` | `/auth/shopify/callback` | OAuth redirect URI |
123
+ | `GET` | `/logout` | Logout |
124
+ | `POST` | `/webhooks/:type` | Webhook callback |
581
125
 
582
- You will need to add an `api_version` method to your session storage object. The default implementation for this is.
583
- ```ruby
584
- def api_version
585
- ShopifyApp.configuration.api_version
586
- end
587
- ```
126
+ These routes are configurable. See the more detailed [*Engine*](/docs/shopify_app/engine.md) documentation to learn how you can customize the login URL or mount the Shopify App Rails engine at nested routes.
588
127
 
589
- ### Generated file change
590
-
591
- `embedded_app.html.erb` the usage of `shop_session.url` needs to be changed to `shop_session.domain`
592
- ```erb
593
- <script type="text/javascript">
594
- ShopifyApp.init({
595
- apiKey: "<%= ShopifyApp.configuration.api_key %>",
596
-
597
- shopOrigin: "<%= "https://#{ @shop_session.url }" if @shop_session %>",
598
-
599
- debug: false,
600
- forceRedirect: true
601
- });
602
- </script>
603
- ```
604
- is changed to
605
- ```erb
606
- <script type="text/javascript">
607
- ShopifyApp.init({
608
- apiKey: "<%= ShopifyApp.configuration.api_key %>",
609
-
610
- shopOrigin: "<%= "https://#{ @shop_session.domain }" if @shop_session %>",
611
-
612
- debug: false,
613
- forceRedirect: true
614
- });
615
- </script>
616
- ```
128
+ To learn more about how this gem authenticates with Shopify, see [*Authentication*](/docs/shopify_app/authentication.md).
617
129
 
618
- ### ShopifyAPI changes
130
+ ### API Versioning
619
131
 
620
- You will need to also follow the ShopifyAPI [upgrade guide](https://github.com/Shopify/shopify_api/blob/master/README.md#-breaking-change-notice-for-version-700-) to ensure your app is ready to work with api versioning.
132
+ [Shopify's API is versioned](https://shopify.dev/concepts/about-apis/versioning). With Shopify App `v1.11.0`, the included Shopify API gem allows developers to specify and update the Shopify API version they want their app or service to use. The Shopify API gem also surfaces warnings to Rails apps about [deprecated endpoints, GraphQL fields and more](https://shopify.dev/concepts/about-apis/versioning#deprecation-practices).
621
133
 
622
- [dashboard]:https://partners.shopify.com
623
- [app-bridge]:https://help.shopify.com/en/api/embedded-apps/app-bridge
134
+ See the [Shopify API gem README](https://github.com/Shopify/shopify-api-ruby/) for more information.