This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Fixes Shopify/shopify-api-js#202
Fixes Shopify/shopify-api-js#130
We currently limit the OAuth process (to 60s) to not have hanging sessions, and the OAuth cookie / session expire after that limit, which currently leads to the server throwing an error rather than completing the process.
To reach that point, we must be in a valid callback request, so it was actually fired by Shopify. If, for whatever reason, the session does not exist at this point, the OAuth process went wrong and it should be retried. For the specific case where the merchant takes too long to approve the app, the retry will just go straight through since the app is already approved, which should make this error transparent.
WHAT is this pull request doing?
Essentially applying the very helpful idea from Shopify/shopify-api-js#130 (comment) to the source, catching session / cookie errors and simply retrying OAuth on both rather than failing.
Type of change
Checklist