shopify_app 14.4.2 → 14.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60cc46a40e00f3426b6953016ec068769159721ba123ea8c46fe70e3134c30e4
4
- data.tar.gz: ddb21388d8ea303c87d7c5c58ef62af5ac34cb536d4b3c49a2383f77721a34f9
3
+ metadata.gz: 4943d62d694b896b3459f7c120ad33e05a71826af48c30c8449e0b213f8792c3
4
+ data.tar.gz: c12f15a9ca8e94f03e6c00dbac9d1e1d6651571cd96991318ec533db069d6fe6
5
5
  SHA512:
6
- metadata.gz: e62cf5da363ed074f959e11034011f9dd4e873b5a3c62bb3d396990900164ceef989d769d6452c0f6f147d9b6b034c8405de5b54305613257930787aa4cc3255
7
- data.tar.gz: 832e0f2c0e48bd1dad2fe355fc0175f736851a2554241195109975b0a356dd5f54b23e624c66ff4c3356153e31427230869f55e1f09ab66b0ad98b689d9d91ed
6
+ metadata.gz: 0fb092bd7b4085ea4f9fafe196c4f56f09a709120e2ae206fb174f8858bb39324335cbfb0b066ad24d131f37d31ec872887899a074436fa6f2290e72dc4f1f43
7
+ data.tar.gz: 1f77669706cd7ad0065bc6b5bc30744a2b9e4da61190266cfb7efc9f2127f1b0c0cd030d968dca1c80ce6bde4c842ed16b9d38bff899e50f63b11e74159572a6
@@ -1,3 +1,7 @@
1
+ 14.4.3
2
+ ------
3
+ * Fix to ensure post authenticate jobs are run after callback requests [#1079](https://github.com/Shopify/shopify_app/pull/1079)
4
+
1
5
  14.4.2
2
6
  ------
3
7
  * Add debug logs in sessions controller
@@ -6,50 +6,77 @@ module ShopifyApp
6
6
  include ShopifyApp::LoginProtection
7
7
 
8
8
  def callback
9
- unless auth_hash
10
- return respond_with_error
11
- end
9
+ return respond_with_error if invalid_request?
12
10
 
13
- if jwt_request? && !valid_jwt_auth?
14
- Rails.logger.debug("[ShopifyApp::CallbackController] Invalid JWT auth detected.")
15
- return respond_with_error
11
+ store_access_token_and_build_session
12
+
13
+ if start_user_token_flow?
14
+ return respond_with_user_token_flow
16
15
  end
17
16
 
17
+ perform_post_authenticate_jobs
18
+
19
+ respond_successfully
20
+ end
21
+
22
+ private
23
+
24
+ def respond_successfully
18
25
  if jwt_request?
19
- Rails.logger.debug("[ShopifyApp::CallbackController] JWT request detected. Setting shopify session...")
20
- set_shopify_session
21
26
  head(:ok)
22
27
  else
28
+ redirect_to(return_address)
29
+ end
30
+ end
31
+
32
+ def respond_with_user_token_flow
33
+ Rails.logger.debug("[ShopifyApp::CallbackController] Redirecting for user token...")
34
+ redirect_to(login_url_with_optional_shop)
35
+ end
36
+
37
+ def store_access_token_and_build_session
38
+ if native_browser_request?
23
39
  Rails.logger.debug("[ShopifyApp::CallbackController] Not a JWT request. Resetting session options...")
24
40
  reset_session_options
25
- set_shopify_session
41
+ else
42
+ Rails.logger.debug("[ShopifyApp::CallbackController] JWT request detected. Setting shopify session...")
43
+ end
44
+ set_shopify_session
45
+ end
26
46
 
27
- if redirect_for_user_token?
28
- Rails.logger.debug("[ShopifyApp::CallbackController] Redirecting for user token...")
29
- return redirect_to(login_url_with_optional_shop)
30
- end
47
+ def invalid_request?
48
+ return true unless auth_hash
31
49
 
32
- install_webhooks
33
- install_scripttags
34
- perform_after_authenticate_job
50
+ jwt_request? && !valid_jwt_auth?
51
+ end
35
52
 
36
- redirect_to(return_address)
37
- end
53
+ def native_browser_request?
54
+ !jwt_request?
38
55
  end
39
56
 
40
- private
57
+ def perform_post_authenticate_jobs
58
+ install_webhooks
59
+ install_scripttags
60
+ perform_after_authenticate_job
61
+ end
41
62
 
42
63
  def respond_with_error
43
64
  if jwt_request?
65
+ Rails.logger.debug("[ShopifyApp::CallbackController] Invalid JWT auth detected.")
44
66
  head(:unauthorized)
45
67
  else
68
+ Rails.logger.debug("[ShopifyApp::CallbackController] Invalid non JWT auth detected.")
46
69
  flash[:error] = I18n.t('could_not_log_in')
47
70
  redirect_to(login_url_with_optional_shop)
48
71
  end
49
72
  end
50
73
 
51
- def redirect_for_user_token?
52
- ShopifyApp::SessionRepository.user_storage.present? && user_session.blank?
74
+ def start_user_token_flow?
75
+ if jwt_request?
76
+ false
77
+ else
78
+ ShopifyApp::SessionRepository.user_storage.present? && user_session.blank?
79
+ end
53
80
  end
54
81
 
55
82
  def jwt_request?
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ShopifyApp
3
- VERSION = '14.4.2'
3
+ VERSION = '14.4.3'
4
4
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "14.4.2",
3
+ "version": "14.4.3",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.4.2
4
+ version: 14.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-22 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_sniffer