Closed zzooeeyy closed 2 months ago
We'll create an API wrapper and handle errors differently, so I'm moving this back to draft.
We decided to keep retrying in the around_action
, but will also introduce a module ShopifyApp::AdminAPI::WithTokenRefetch
that offers a method that will automatically re-fetch an access token on Unauthorized
errors and retry the block.
with_token_refetch(@session, @session_token) do
# Admin API call here
end
The tests that execute the new Session#copy_attributes_from
method are now failing until we update the shopify_api
version to include it.
📹 Demo video
What this PR does
around_action
in token exchange concernactivate_shopfiy_session
.ShopifyApp::Auth::TokenExchange.perform(session_token)
ShopifyApp::AdminAPI::WithTokenRefetch
module with a method to allow easy token refetch/retry on Unauthorized errorsSo developers handling their own errors can still have their access tokens refetched:
Checklist
Before submitting the PR, please consider if any of the following are needed:
CHANGELOG.md
if the changes would impact usersREADME.md
, if appropriate./docs
, if necessary