Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Retry OAuth if cookie / session expired #112

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

paulomarg
Copy link
Contributor

@paulomarg paulomarg commented Jul 19, 2021

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

  • Patch: Bug (non-breaking change which fixes an issue)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above
  • I have added/updated tests for this change

@paulomarg paulomarg requested a review from a team July 19, 2021 14:21
@paulomarg paulomarg force-pushed the retry_auth_on_missing_cookie branch from 0df44fd to 20fcde4 Compare July 19, 2021 14:22
Copy link
Contributor

@mllemango mllemango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@paulomarg paulomarg merged commit e70874f into master Jul 19, 2021
@paulomarg paulomarg deleted the retry_auth_on_missing_cookie branch July 19, 2021 14:28
@shopify-shipit shopify-shipit bot temporarily deployed to production July 19, 2021 14:31 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants