shopify_app 14.4.3 → 16.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +5 -0
- data/.github/workflows/build.yml +38 -0
- data/.github/workflows/rubocop.yml +1 -7
- data/.gitignore +0 -2
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +252 -0
- data/README.md +22 -6
- data/app/assets/images/storage_access.svg +1 -2
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +22 -0
- data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
- data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
- data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
- data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
- data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
- data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
- data/app/views/shopify_app/sessions/enable_cookies.html.erb +1 -1
- data/app/views/shopify_app/sessions/new.html.erb +38 -110
- data/app/views/shopify_app/sessions/request_storage_access.html.erb +1 -1
- data/app/views/shopify_app/sessions/top_level_interaction.html.erb +20 -15
- data/docs/Releasing.md +6 -4
- data/lib/generators/shopify_app/controllers/controllers_generator.rb +1 -1
- data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +16 -7
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +10 -10
- data/lib/generators/shopify_app/install/install_generator.rb +6 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +4 -3
- data/lib/generators/shopify_app/views/views_generator.rb +1 -1
- data/lib/shopify_app/configuration.rb +3 -0
- data/lib/shopify_app/controller_concerns/login_protection.rb +3 -1
- data/lib/shopify_app/engine.rb +21 -0
- data/lib/shopify_app/session/jwt.rb +3 -1
- data/lib/shopify_app/version.rb +1 -1
- data/package.json +1 -1
- metadata +6 -3
- data/.travis.yml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44ec6da287b58bdae2e84213de7ef0780078bd09c7c25558b75e738e7b1fe8ae
|
4
|
+
data.tar.gz: fc2e72d9c007933a42c45f286b259b2a27a425b0174aadd9095f140d2707922a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf8d2e8fda1d93bf9bee47491662d751be025f2f3dd80cf0e6bc92fc7a5577481dcf78fcba8e9dee1c03c0b5ebf34c686e062eb03313de9679ca3056f675b669
|
7
|
+
data.tar.gz: a71980adc7d070ba469e1fe1a15b69ebbadf8f4f871b3fb2ccc32d989df85cbb702df5101c5cc57b253416693530cd412011e227dc5aa9a24c96e2efddcdb506
|
data/.github/ISSUE_TEMPLATE.md
CHANGED
@@ -12,3 +12,8 @@ Authentication Issues
|
|
12
12
|
A great deal of the issues surrounding this repo are around authenticating (installing) the generated app with Shopify.
|
13
13
|
|
14
14
|
If you are experiencing issues with your app authenticating/installing the best way to get help fast is to create a repo with the minimal amount of code to demonstrate the issue and a clearly documented set of steps you took to arrive there. This will help us solve your problem quicker since we won't need to spend any time figuring out how to reproduce the bug. Please also include your operating system and browser.
|
15
|
+
|
16
|
+
Security
|
17
|
+
--------
|
18
|
+
|
19
|
+
Please be certain to redact any private information from your logs or code snippets such as Api Keys, Api Secrets, and any authentication tokens such as shop_tokens.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
runs-on: macos-latest # prevents intermittent Chrome Headless error unlike ubuntu
|
9
|
+
name: Ruby ${{ matrix.version }}
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
version: [2.5, 2.6, 2.7]
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Cache node modules
|
17
|
+
uses: actions/cache@v2
|
18
|
+
with:
|
19
|
+
# npm cache files are stored in `~/.npm` on Linux/macOS
|
20
|
+
path: ~/.npm
|
21
|
+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
22
|
+
- name: Set up Ruby ${{ matrix.version }}
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.version }}
|
26
|
+
bundler-cache: true
|
27
|
+
- name: Set up Node
|
28
|
+
uses: actions/setup-node@v2-beta
|
29
|
+
with:
|
30
|
+
node-version: '12'
|
31
|
+
- name: Install Dependencies
|
32
|
+
run: |
|
33
|
+
yarn
|
34
|
+
- name: Run Tests
|
35
|
+
run: |
|
36
|
+
yarn test
|
37
|
+
bundle exec rake test
|
38
|
+
|
@@ -12,13 +12,7 @@ jobs:
|
|
12
12
|
uses: ruby/setup-ruby@v1
|
13
13
|
with:
|
14
14
|
ruby-version: 2.7
|
15
|
-
|
16
|
-
uses: actions/cache@v1
|
17
|
-
with:
|
18
|
-
path: vendor/bundle
|
19
|
-
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
|
20
|
-
restore-keys: |
|
21
|
-
${{ runner.os }}-rubocop-
|
15
|
+
bundler-cache: true
|
22
16
|
- name: Install gems
|
23
17
|
run: |
|
24
18
|
bundle config path vendor/bundle
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
16.1.0
|
2
|
+
------
|
3
|
+
* Use Session Token auth strategy by default for new embedded apps [#1111](https://github.com/Shopify/shopify_app/pull/1111)
|
4
|
+
* Create optional `EnsureAuthenticatedLinks` concern to authenticate deep links using Turbolinks [#1118](https://github.com/Shopify/shopify_app/pull/1118)
|
5
|
+
|
6
|
+
16.0.0
|
7
|
+
------
|
8
|
+
* Update all `html.erb` and `css` files to correspond with updated store admin design language [#1102](https://github.com/Shopify/shopify_app/pull/1102)
|
9
|
+
|
10
|
+
15.0.1
|
11
|
+
------
|
12
|
+
* Allow JWT session token `sub` field to be parsed as a string [#1103](https://github.com/Shopify/shopify_app/pull/1103)
|
13
|
+
|
14
|
+
15.0.0
|
15
|
+
------
|
16
|
+
* Change `X-Shopify-API-Request-Failure-Unauthorized` HTTP header value from boolean to string
|
17
|
+
|
18
|
+
14.4.4
|
19
|
+
------
|
20
|
+
* Patch to not log params in ShopifyApp jobs [#1086](https://github.com/Shopify/shopify_app/pull/1086)
|
21
|
+
|
1
22
|
14.4.3
|
2
23
|
------
|
3
24
|
* Fix to ensure post authenticate jobs are run after callback requests [#1079](https://github.com/Shopify/shopify_app/pull/1079)
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
shopify_app (16.1.0)
|
5
|
+
browser_sniffer (~> 1.2.2)
|
6
|
+
jwt (~> 2.2.1)
|
7
|
+
omniauth-shopify-oauth2 (~> 2.2.2)
|
8
|
+
rails (> 5.2.1)
|
9
|
+
redirect_safely (~> 1.0)
|
10
|
+
shopify_api (~> 9.1)
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
actioncable (6.0.3.3)
|
16
|
+
actionpack (= 6.0.3.3)
|
17
|
+
nio4r (~> 2.0)
|
18
|
+
websocket-driver (>= 0.6.1)
|
19
|
+
actionmailbox (6.0.3.3)
|
20
|
+
actionpack (= 6.0.3.3)
|
21
|
+
activejob (= 6.0.3.3)
|
22
|
+
activerecord (= 6.0.3.3)
|
23
|
+
activestorage (= 6.0.3.3)
|
24
|
+
activesupport (= 6.0.3.3)
|
25
|
+
mail (>= 2.7.1)
|
26
|
+
actionmailer (6.0.3.3)
|
27
|
+
actionpack (= 6.0.3.3)
|
28
|
+
actionview (= 6.0.3.3)
|
29
|
+
activejob (= 6.0.3.3)
|
30
|
+
mail (~> 2.5, >= 2.5.4)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
actionpack (6.0.3.3)
|
33
|
+
actionview (= 6.0.3.3)
|
34
|
+
activesupport (= 6.0.3.3)
|
35
|
+
rack (~> 2.0, >= 2.0.8)
|
36
|
+
rack-test (>= 0.6.3)
|
37
|
+
rails-dom-testing (~> 2.0)
|
38
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
39
|
+
actiontext (6.0.3.3)
|
40
|
+
actionpack (= 6.0.3.3)
|
41
|
+
activerecord (= 6.0.3.3)
|
42
|
+
activestorage (= 6.0.3.3)
|
43
|
+
activesupport (= 6.0.3.3)
|
44
|
+
nokogiri (>= 1.8.5)
|
45
|
+
actionview (6.0.3.3)
|
46
|
+
activesupport (= 6.0.3.3)
|
47
|
+
builder (~> 3.1)
|
48
|
+
erubi (~> 1.4)
|
49
|
+
rails-dom-testing (~> 2.0)
|
50
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
51
|
+
activejob (6.0.3.3)
|
52
|
+
activesupport (= 6.0.3.3)
|
53
|
+
globalid (>= 0.3.6)
|
54
|
+
activemodel (6.0.3.3)
|
55
|
+
activesupport (= 6.0.3.3)
|
56
|
+
activemodel-serializers-xml (1.0.2)
|
57
|
+
activemodel (> 5.x)
|
58
|
+
activesupport (> 5.x)
|
59
|
+
builder (~> 3.1)
|
60
|
+
activerecord (6.0.3.3)
|
61
|
+
activemodel (= 6.0.3.3)
|
62
|
+
activesupport (= 6.0.3.3)
|
63
|
+
activeresource (5.1.1)
|
64
|
+
activemodel (>= 5.0, < 7)
|
65
|
+
activemodel-serializers-xml (~> 1.0)
|
66
|
+
activesupport (>= 5.0, < 7)
|
67
|
+
activestorage (6.0.3.3)
|
68
|
+
actionpack (= 6.0.3.3)
|
69
|
+
activejob (= 6.0.3.3)
|
70
|
+
activerecord (= 6.0.3.3)
|
71
|
+
marcel (~> 0.3.1)
|
72
|
+
activesupport (6.0.3.3)
|
73
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
74
|
+
i18n (>= 0.7, < 2)
|
75
|
+
minitest (~> 5.1)
|
76
|
+
tzinfo (~> 1.1)
|
77
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
78
|
+
addressable (2.7.0)
|
79
|
+
public_suffix (>= 2.0.2, < 5.0)
|
80
|
+
ast (2.4.1)
|
81
|
+
binding_of_caller (0.8.0)
|
82
|
+
debug_inspector (>= 0.0.1)
|
83
|
+
browser_sniffer (1.2.2)
|
84
|
+
builder (3.2.4)
|
85
|
+
byebug (11.1.3)
|
86
|
+
coderay (1.1.3)
|
87
|
+
concurrent-ruby (1.1.7)
|
88
|
+
crack (0.4.4)
|
89
|
+
crass (1.0.6)
|
90
|
+
debug_inspector (0.0.3)
|
91
|
+
erubi (1.9.0)
|
92
|
+
faraday (1.1.0)
|
93
|
+
multipart-post (>= 1.2, < 3)
|
94
|
+
ruby2_keywords
|
95
|
+
globalid (0.4.2)
|
96
|
+
activesupport (>= 4.2.0)
|
97
|
+
graphql (1.11.6)
|
98
|
+
graphql-client (0.16.0)
|
99
|
+
activesupport (>= 3.0)
|
100
|
+
graphql (~> 1.8)
|
101
|
+
hashdiff (1.0.1)
|
102
|
+
hashie (4.1.0)
|
103
|
+
i18n (1.8.5)
|
104
|
+
concurrent-ruby (~> 1.0)
|
105
|
+
jwt (2.2.2)
|
106
|
+
loofah (2.7.0)
|
107
|
+
crass (~> 1.0.2)
|
108
|
+
nokogiri (>= 1.5.9)
|
109
|
+
mail (2.7.1)
|
110
|
+
mini_mime (>= 0.1.1)
|
111
|
+
marcel (0.3.3)
|
112
|
+
mimemagic (~> 0.3.2)
|
113
|
+
method_source (0.9.2)
|
114
|
+
mimemagic (0.3.5)
|
115
|
+
mini_mime (1.0.2)
|
116
|
+
mini_portile2 (2.4.0)
|
117
|
+
minitest (5.14.2)
|
118
|
+
mocha (1.11.2)
|
119
|
+
multi_json (1.15.0)
|
120
|
+
multi_xml (0.6.0)
|
121
|
+
multipart-post (2.1.1)
|
122
|
+
nio4r (2.5.4)
|
123
|
+
nokogiri (1.10.10)
|
124
|
+
mini_portile2 (~> 2.4.0)
|
125
|
+
oauth2 (1.4.4)
|
126
|
+
faraday (>= 0.8, < 2.0)
|
127
|
+
jwt (>= 1.0, < 3.0)
|
128
|
+
multi_json (~> 1.3)
|
129
|
+
multi_xml (~> 0.5)
|
130
|
+
rack (>= 1.2, < 3)
|
131
|
+
omniauth (1.9.1)
|
132
|
+
hashie (>= 3.4.6)
|
133
|
+
rack (>= 1.6.2, < 3)
|
134
|
+
omniauth-oauth2 (1.5.0)
|
135
|
+
oauth2 (~> 1.1)
|
136
|
+
omniauth (~> 1.2)
|
137
|
+
omniauth-shopify-oauth2 (2.2.3)
|
138
|
+
activesupport
|
139
|
+
omniauth-oauth2 (~> 1.5.0)
|
140
|
+
parallel (1.20.1)
|
141
|
+
parser (2.7.2.0)
|
142
|
+
ast (~> 2.4.1)
|
143
|
+
pry (0.12.2)
|
144
|
+
coderay (~> 1.1.0)
|
145
|
+
method_source (~> 0.9.0)
|
146
|
+
pry-nav (0.3.0)
|
147
|
+
pry (>= 0.9.10, < 0.13.0)
|
148
|
+
pry-stack_explorer (0.4.9.3)
|
149
|
+
binding_of_caller (>= 0.7)
|
150
|
+
pry (>= 0.9.11)
|
151
|
+
public_suffix (4.0.6)
|
152
|
+
rack (2.2.3)
|
153
|
+
rack-test (1.1.0)
|
154
|
+
rack (>= 1.0, < 3)
|
155
|
+
rails (6.0.3.3)
|
156
|
+
actioncable (= 6.0.3.3)
|
157
|
+
actionmailbox (= 6.0.3.3)
|
158
|
+
actionmailer (= 6.0.3.3)
|
159
|
+
actionpack (= 6.0.3.3)
|
160
|
+
actiontext (= 6.0.3.3)
|
161
|
+
actionview (= 6.0.3.3)
|
162
|
+
activejob (= 6.0.3.3)
|
163
|
+
activemodel (= 6.0.3.3)
|
164
|
+
activerecord (= 6.0.3.3)
|
165
|
+
activestorage (= 6.0.3.3)
|
166
|
+
activesupport (= 6.0.3.3)
|
167
|
+
bundler (>= 1.3.0)
|
168
|
+
railties (= 6.0.3.3)
|
169
|
+
sprockets-rails (>= 2.0.0)
|
170
|
+
rails-controller-testing (1.0.5)
|
171
|
+
actionpack (>= 5.0.1.rc1)
|
172
|
+
actionview (>= 5.0.1.rc1)
|
173
|
+
activesupport (>= 5.0.1.rc1)
|
174
|
+
rails-dom-testing (2.0.3)
|
175
|
+
activesupport (>= 4.2.0)
|
176
|
+
nokogiri (>= 1.6)
|
177
|
+
rails-html-sanitizer (1.3.0)
|
178
|
+
loofah (~> 2.3)
|
179
|
+
railties (6.0.3.3)
|
180
|
+
actionpack (= 6.0.3.3)
|
181
|
+
activesupport (= 6.0.3.3)
|
182
|
+
method_source
|
183
|
+
rake (>= 0.8.7)
|
184
|
+
thor (>= 0.20.3, < 2.0)
|
185
|
+
rainbow (3.0.0)
|
186
|
+
rake (13.0.1)
|
187
|
+
rb-readline (0.5.5)
|
188
|
+
redirect_safely (1.0.0)
|
189
|
+
activemodel
|
190
|
+
regexp_parser (2.0.0)
|
191
|
+
rexml (3.2.4)
|
192
|
+
rubocop (1.5.2)
|
193
|
+
parallel (~> 1.10)
|
194
|
+
parser (>= 2.7.1.5)
|
195
|
+
rainbow (>= 2.2.2, < 4.0)
|
196
|
+
regexp_parser (>= 1.8, < 3.0)
|
197
|
+
rexml
|
198
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
199
|
+
ruby-progressbar (~> 1.7)
|
200
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
201
|
+
rubocop-ast (1.3.0)
|
202
|
+
parser (>= 2.7.1.5)
|
203
|
+
rubocop-shopify (1.0.7)
|
204
|
+
rubocop (~> 1.4)
|
205
|
+
ruby-progressbar (1.10.1)
|
206
|
+
ruby2_keywords (0.0.2)
|
207
|
+
shopify_api (9.2.0)
|
208
|
+
activeresource (>= 4.1.0, < 6.0.0)
|
209
|
+
graphql-client
|
210
|
+
rack
|
211
|
+
sprockets (4.0.2)
|
212
|
+
concurrent-ruby (~> 1.0)
|
213
|
+
rack (> 1, < 3)
|
214
|
+
sprockets-rails (3.2.2)
|
215
|
+
actionpack (>= 4.0)
|
216
|
+
activesupport (>= 4.0)
|
217
|
+
sprockets (>= 3.0.0)
|
218
|
+
sqlite3 (1.4.2)
|
219
|
+
thor (1.0.1)
|
220
|
+
thread_safe (0.3.6)
|
221
|
+
tzinfo (1.2.7)
|
222
|
+
thread_safe (~> 0.1)
|
223
|
+
unicode-display_width (1.7.0)
|
224
|
+
webmock (3.9.1)
|
225
|
+
addressable (>= 2.3.6)
|
226
|
+
crack (>= 0.3.2)
|
227
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
228
|
+
websocket-driver (0.7.3)
|
229
|
+
websocket-extensions (>= 0.1.0)
|
230
|
+
websocket-extensions (0.1.5)
|
231
|
+
zeitwerk (2.4.0)
|
232
|
+
|
233
|
+
PLATFORMS
|
234
|
+
ruby
|
235
|
+
|
236
|
+
DEPENDENCIES
|
237
|
+
byebug
|
238
|
+
minitest
|
239
|
+
mocha
|
240
|
+
pry
|
241
|
+
pry-nav
|
242
|
+
pry-stack_explorer
|
243
|
+
rails-controller-testing
|
244
|
+
rake
|
245
|
+
rb-readline
|
246
|
+
rubocop-shopify
|
247
|
+
shopify_app!
|
248
|
+
sqlite3 (~> 1.4)
|
249
|
+
webmock
|
250
|
+
|
251
|
+
BUNDLED WITH
|
252
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Shopify App
|
2
2
|
===========
|
3
|
-
[![Version][gem]][gem_url] [![Build Status](https://
|
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
|
@@ -26,7 +26,7 @@ Table of Contents
|
|
26
26
|
- [Troubleshooting](#troubleshooting)
|
27
27
|
- [Testing an embedded app outside the Shopify admin](#testing-an-embedded-app-outside-the-shopify-admin)
|
28
28
|
- [Migration to 13.0.0](#migrating-to-1300)
|
29
|
-
- [Questions or problems?](#questions-or-problems
|
29
|
+
- [Questions or problems?](#questions-or-problems)
|
30
30
|
- [Rails 6 Compatibility](#rails-6-compatibility)
|
31
31
|
- [Upgrading from 8.6 to 9.0.0](#upgrading-from-86-to-900)
|
32
32
|
|
@@ -105,8 +105,9 @@ Options include:
|
|
105
105
|
* `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"`)
|
106
106
|
* `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
|
107
107
|
(e.g. `--scope read_products, write_orders, write_products` or `--scope "read_products, write_orders, write_products"`)
|
108
|
-
For more information, refer the [docs](http://docs.shopify.com/api/tutorials/oauth).
|
108
|
+
For more information, refer to the [docs](http://docs.shopify.com/api/tutorials/oauth).
|
109
109
|
* `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`
|
110
|
+
* __[Not recommended for embedded apps]__ `with-cookie-authentication` - sets up the authentication strategy of the app to use cookies. By default, it uses JWT based session tokens.
|
110
111
|
|
111
112
|
You can update any of these settings later on easily; the arguments are simply for convenience.
|
112
113
|
|
@@ -121,10 +122,10 @@ After running the `install` generator, you can start your app with `bundle exec
|
|
121
122
|
$ rails generate shopify_app:home_controller
|
122
123
|
```
|
123
124
|
|
124
|
-
This generator creates an example home controller and view which fetches and displays products using the Shopify API.
|
125
|
+
This generator creates an example home controller and view which fetches and displays products using the Shopify API. By default, this generator creates an unauthenticated home_controller and a sample protected products_controller.
|
125
126
|
|
126
127
|
Options include:
|
127
|
-
* __[
|
128
|
+
* __[Not recommended for embedded apps]__ `with-cookie-authentication` - This flag generates an authenticated home_controller, where the authentication strategy relies on cookies. By default, this generator creates an unauthenticated home_controller and protected sample products_controller.
|
128
129
|
|
129
130
|
### Products Controller Generator
|
130
131
|
|
@@ -279,6 +280,21 @@ The engine provides a `ShopifyApp::Authenticated` concern which should be includ
|
|
279
280
|
|
280
281
|
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`.
|
281
282
|
|
283
|
+
### EnsureAuthenticatedLinks
|
284
|
+
|
285
|
+
The `ShopifyApp::EnsureAuthenticatedLinks` concern helps authenticate users that access protected pages of your app directly.
|
286
|
+
|
287
|
+
Include this concern in your app's `AuthenticatedController` if your app uses session tokens with [Turbolinks](https://shopify.dev/tutorials/authenticate-server-side-rendered-apps-with-session-tokens-app-bridge-turbolinks). It adds a `before_action` filter that detects whether a session token is present or not. If a session is not found, the user is redirected to your app's splash page path (`root_path`) along with `return_to` and `shop` parameters.
|
288
|
+
|
289
|
+
Example `AuthenticatedController`:
|
290
|
+
|
291
|
+
```rb
|
292
|
+
class AuthenticatedController < ApplicationController
|
293
|
+
include ShopifyApp::EnsureAuthenticatedLinks
|
294
|
+
include ShopifyApp::Authenticated
|
295
|
+
end
|
296
|
+
```
|
297
|
+
|
282
298
|
### AfterAuthenticate Job
|
283
299
|
|
284
300
|
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:
|
@@ -427,7 +443,7 @@ bin/rails g shopify_app:rotate_shopify_token_job
|
|
427
443
|
|
428
444
|
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.
|
429
445
|
|
430
|
-
⚠️ 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/
|
446
|
+
⚠️ 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/initializers/omniauth.rb`:
|
431
447
|
|
432
448
|
```ruby
|
433
449
|
strategy.options[:old_client_secret] = ShopifyApp.configuration.old_secret
|
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
<svg enable-background="new 0 0 1920 1080" version="1.1" viewBox="0 0 1920 1080" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><polygon points="1345 330.75 1345 437.24 1224.7 437.24 1224.7 676.56 873.52 676.56 874.04 643.85 1203.2 330.23" fill="#fff"/><path d="m1095.7 677.54c-18.553 0.074-37.107 0.163-55.66 0.126-18.553 0.056-37.107-0.188-55.66-0.233l-13.915-0.063-13.915 0.044-27.83 0.094c-18.553 0.128-37.107-5e-3 -55.66-0.056l-1.266-3e-3 3e-3 -1.259 0.047-22.532-0.093-22.532-0.068-11.266 6e-3 -11.266 0.019-22.532h2.703l0.111 22.532c0.053 7.511 0.06 15.022 0.038 22.532l-0.094 45.065-1.407-1.407c18.553 7e-3 37.107-0.041 55.66 0.086l27.83 0.131 13.915 0.066 13.915-0.028c18.553-8e-3 37.107-0.151 55.66-0.019 18.553 0.099 37.107 0.049 55.66-0.181v2.701z" fill="#0C1238"/><path d="m1225 677.54c-9.24 0.123-18.48 0.187-27.72 0.077l-13.86-0.213c-2.31-0.051-4.62-0.023-6.93 1e-3l-6.93 0.062c-9.24 0.156-18.48 0.076-27.72-0.054-2.31-0.034-4.62 1e-3 -6.93 2e-3l-6.93 0.121c-4.62 0.062-9.24-2e-3 -13.86 3e-3v-2.703c4.62-0.048 9.24-0.165 13.86-0.157l6.93 0.025c2.31 0.027 4.62 0.088 6.93 0.076 9.24-0.024 18.48-0.031 27.72 0.145 4.62 0.038 9.24 0.163 13.86 0.126l13.86-0.081c4.62-0.04 9.24 0.088 13.86 0.101 2.31 0.047 4.62-0.048 6.93-0.065 2.31-0.026 4.62-0.07 6.93-0.169v2.703z" fill="#0C1238"/><path d="m871.68 561.78l-0.13-115.72 0.07-115.72 1e-3 -1.414 1.411 3e-3 117.9 0.228 117.9-0.138 58.951-0.061 58.951 0.072 117.9 0.09 1.218 1e-3 4e-3 1.221 0.156 53.426-0.026 53.426h-2.703l-0.154-53.426 0.04-53.426 1.466 1.466-235.8-0.148-117.9-0.193-117.9 0.087 1.212-1.212-0.084 115.72c-0.058 19.286 0.032 38.573 0.074 57.859l0.15 57.859h-2.705z" fill="#0C1238"/><g fill="#E6E8F0"><circle cx="891.37" cy="344.49" r="6.812"/><circle cx="912.86" cy="345.01" r="6.812"/><circle cx="934.34" cy="345.54" r="6.812"/><path d="m1202.7 352.87h-186.64c-0.552 0-1-0.448-1-1v-11.624c0-0.552 0.448-1 1-1h186.64c0.552 0 1 0.448 1 1v11.624c0 0.552-0.448 1-1 1z" stroke="#F0F3F5" stroke-miterlimit="10"/><rect x="1288.6" y="339.25" width="17.816" height="13.624"/><path d="m1327.4 352.87h-15.816c-0.552 0-1-0.448-1-1v-11.624c0-0.552 0.448-1 1-1h15.816c0.552 0 1 0.448 1 1v11.624c0 0.552-0.447 1-1 1z"/></g><g fill="none" stroke="#8891EA" stroke-miterlimit="10" stroke-width="8"><path d="m1098.3 576.8c-24.295 0-43.99-19.695-43.99-43.99v-29.485c0-2.209 1.791-4 4-4h79.98c2.209 0 4 1.791 4 4v29.485c0 24.295-19.695 43.99-43.99 43.99z"/><path d="m1066 499.33v-12.41c0-17.804 14.433-32.237 32.237-32.237s32.237 14.433 32.237 32.237v12.41"/></g><circle cx="1098.3" cy="529.08" r="8.966" fill="#8891EA"/><line x1="1098.3" x2="1098.3" y1="529.08" y2="546.68" fill="#fff" stroke="#8891EA" stroke-linecap="round" stroke-miterlimit="10" stroke-width="8"/><polygon points="1416.1 676.19 1358 748.57 1416.1 749.77 1225 749.77 1225 659.42 1416.1 437.19" fill="#fff"/><path d="m1415.2 497.07l-0.12-59.83 1.472 1.472-95.89-0.052-47.945-0.135c-15.982-0.023-31.963-0.14-47.945-0.085l1.2-1.2 0.139 78.077c0.086 26.026 4e-3 52.052-0.039 78.077l-0.076 78.077c0.056 26.026 0.201 52.052 0.145 78.077l-1.368-1.368 38.25 0.017v2.703l-38.251 0.1-1.444 4e-3 -6e-3 -1.454c-0.102-26.026-0.045-52.052-0.026-78.077l0.068-78.077 0.067-78.077 0.191-78.077 3e-3 -1.15h1.147l47.945-0.013 47.945-0.051 95.89 0.089 1.121 1e-3 4e-3 1.125 0.226 59.83h-2.703z" fill="#0C1238"/><path d="m1417.9 518.33c0.051 19.268 0.165 38.536 0.128 57.804l-0.022 28.902-0.134 28.902-0.134 28.902 0.061 28.902 0.087 28.902 0.046 14.451-0.034 14.451-3e-3 1.353-1.347-3e-3c-22.64-0.042-45.28-0.192-67.919-0.118l-33.96 0.144-33.96-0.025v-2.703l33.96-0.143 33.96 0.01c11.32 0.049 22.64 0.1 33.96 0.078l33.96-2e-3 -1.409 1.409c-0.03-19.268 0.125-38.536 0.178-57.804l0.103-28.902-0.051-28.902-0.051-28.902 0.081-28.902c0.128-19.268-0.116-38.536-0.204-57.804h2.704z" fill="#0C1238"/><path d="m1400.3 458.72h-160.44c-0.552 0-1-0.448-1-1v-11.624c0-0.552 0.448-1 1-1h160.44c0.552 0 1 0.448 1 1v11.624c0 0.552-0.448 1-1 1z" fill="#E6E8F0" stroke="#F0F3F5" stroke-miterlimit="10"/><path d="m1238.5 467.44c13.587-0.084 27.173-0.121 40.76-0.055l20.38 0.141c6.793 0.061 13.587-0.03 20.38-0.038 13.587-0.116 27.173-0.022 40.76 0.038 6.793 0.029 13.587-0.022 20.38-0.082 6.793-0.046 13.587 0 20.38-5e-3v1.802c-13.587 0.111-27.173 0.144-40.76 0.036-13.587 2e-3 -27.173 0.027-40.76-0.09-6.793-0.025-13.587-0.117-20.38-0.088l-20.38 0.054c-6.793 0.022-13.587-0.048-20.38-0.067-6.793-7e-3 -13.587 0.107-20.38 0.154v-1.8z" fill="#E6E8F0"/><path d="m891.69 362.56c36.392-0.084 72.784-0.121 109.18-0.055l54.588 0.141c18.196 0.062 36.392-0.034 54.588-0.043l218.35-0.043v1.802c-36.392 0.111-72.784 0.144-109.18 0.036l-109.18-0.09-54.588-0.088-54.588 0.054-54.588-0.067-54.588 0.154v-1.801z" fill="#E6E8F0"/><g fill="none" stroke="#8891EA" stroke-miterlimit="10" stroke-width="6"><path d="m1320.6 638.41c-17.878 0-32.371-14.493-32.371-32.371v-21.697c0-1.626 1.318-2.943 2.943-2.943h58.854c1.626 0 2.943 1.318 2.943 2.943v21.697c1e-3 17.878-14.491 32.371-32.369 32.371z"/><path d="m1296.9 581.4v-9.132c0-13.101 10.62-23.722 23.722-23.722 13.101 0 23.722 10.621 23.722 23.722v9.132"/></g><circle cx="1320.6" cy="604.5" r="5.88" fill="#8891EA"/><line x1="1320.6" x2="1320.6" y1="603.3" y2="616.25" fill="#fff" stroke="#8891EA" stroke-linecap="round" stroke-miterlimit="10" stroke-width="6"/><path d="m966.35 697.36l-0.029 13.745c-0.01 1.145 0.011 2.291-0.023 3.436l-0.124 3.436c-0.103 2.291 0.022 4.582 0.121 6.872l-1.912-1.912c10.168-0.857 20.337-0.478 30.505-0.36 5.084 0.104 10.168 0.133 15.252 0.178 5.084 6e-3 10.168 0.199 15.252 0.287l7.626 0.168 7.626 0.264c2.542 0.09 5.084 0.032 7.626 0.023 2.542-0.035 5.084 0.047 7.626 0.065 10.168 0.377 20.337-0.052 30.505 0.201l7.626 0.04c2.542 6e-3 5.084-0.283 7.626-0.394 5.084-0.14 10.168-0.184 15.252-0.268 5.084-0.072 10.168-0.071 15.252-0.204 2.542-0.07 5.084-0.088 7.626-0.118 2.542-0.019 5.084 0.1 7.626 0.143 10.168 0.462 20.337-0.303 30.505 0.192 2.542 0.145 5.084 0.163 7.626 0.139 2.542 0 5.084-0.038 7.626-0.099l15.252-0.314v3.936l-15.252 0.106c-5.084 0.024-10.168 0.012-15.252 0.3-10.168 0.483-20.337-0.281-30.505-0.213-20.337-1.165-40.673 0.704-61.01-0.137-2.542 0.117-5.084 0.33-7.626 0.382-2.542 0.092-5.084 0.173-7.626-0.018s-5.084-0.219-7.626-0.183c-2.542-2e-3 -5.084 0.099-7.626 0.081-2.542-0.027-5.084 0.026-7.626-0.066-1.271-0.039-2.542-0.079-3.813-0.09-1.271-0.022-2.542-0.05-3.813 0.018-2.542 0.097-5.084 0.355-7.626 0.327-1.271-0.037-2.542-0.06-3.813-0.12l-3.813-0.238c-2.542-0.162-5.084-0.324-7.626-0.268-2.542 0.109-5.084-0.092-7.626-0.222-2.542-0.112-5.084-0.326-7.626-0.371-2.542-0.094-5.084-0.061-7.626-0.038-5.084 0.101-10.168 0.266-15.252 0.414-2.542 0.071-5.084 0.122-7.626 0.123l-7.626-0.19-1.598-0.04 0.032-1.527c0.047-2.291 0.153-4.582 9e-3 -6.872l-0.162-3.436c-0.047-1.145-0.04-2.291-0.062-3.436l-0.186-13.745h3.934z" fill="#E6E8F0"/><path d="m1434.8 722.88l16.096 0.019 8.048 0.01c2.683 0.018 5.365-0.029 8.048 0.05l-1.89 1.89c0.07-3.44 0.218-6.88 0.086-10.32l-0.312-10.32c-0.261-6.88-0.364-13.76-0.339-20.639l0.314-41.279c0.052-6.88 0.033-13.76 0.144-20.639l0.275-20.639c0.057-6.88 0.274-13.76 0.375-20.639 0.058-6.88-0.069-13.76 0.033-20.639l0.226-20.639-0.071-10.32-0.046-5.16 0.032-5.16 0.11-20.639c0.012-3.44 0.045-6.88-0.068-10.32-0.149-3.44-0.261-6.88-0.361-10.32l-0.328-41.279c-0.074-6.88-0.188-13.76-0.211-20.639 0.028-6.88 0.177-13.76 0.261-20.639l1.77 1.77c-4.37-0.095-8.74 1e-3 -13.111 1e-3l-13.111 0.063c-4.37 1e-3 -8.74 0.084-13.111 0.016l-13.111-0.231c-4.37-0.118-8.74-0.058-13.111-0.055-4.37-4e-3 -8.74 0.077-13.111 0.113l-26.221 0.29v-3.936l26.221-0.107 13.111-0.052c4.37-0.026 8.74 2e-3 13.111-0.14l13.111-0.262c4.37-0.066 8.74 0.04 13.111 0.051l26.221 0.283 2.211 0.024-0.016 2.172c-0.049 6.88-0.045 13.76-0.139 20.639-0.152 6.88-0.325 13.76-0.304 20.639l0.499 41.279c-0.024 1.72-0.037 3.44-0.138 5.16l-0.297 5.16c-0.137 3.44-0.045 6.88 0.01 10.32 0.12 6.88 0.479 13.76 0.59 20.639 0.273 6.88-0.127 13.76-0.227 20.639-0.014 6.88 0.146 13.76 0.091 20.639 0.051 6.88-0.202 13.76-0.162 20.639 0.04 3.44 0.226 6.88 0.324 10.32 0.061 3.44 4e-3 6.88-0.082 10.32l-0.356 10.32c-0.047 1.72-0.141 3.44-0.149 5.16l2e-3 5.16c-0.012 1.72 0.032 3.44-0.026 5.16l-0.164 5.16-0.335 10.32c-0.306 13.76 0.065 27.519 0.289 41.279 0.074 3.44 0.091 6.88 0.13 10.32 0.059 3.44-0.071 6.88-0.098 10.32l-0.153 10.32c-0.053 1.72 0.021 3.44 0.049 5.16l0.139 5.16 0.044 1.627-1.73 0.06c-2.683 0.093-5.365 0.065-8.048 0.1l-8.048 0.061-16.096 0.121v-3.941z" fill="#E6E8F0"/></svg>
|
1
|
+
<svg width="140" height="140" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M79 55a9 9 0 00-18 0v8h18v-8zm6 8v-8a15 15 0 00-30 0v8h-5a2 2 0 00-2 2v20a15 15 0 0015 15h14a15 15 0 0015-15V65a2 2 0 00-2-2h-5zM70 90a3 3 0 01-3-3V75a3 3 0 116 0v12a3 3 0 01-3 3z" fill="#8C9196"/></svg>
|