Shopify / shopify-app-template-remix

371 stars 149 forks source link

await deleting the sessions on uninstall webhook #862

Closed iphipps closed 1 month ago

iphipps commented 1 month ago

WHY are these changes introduced?

The afterAuth hook runs once on install. If a developer uninstalls and reinstalls, the afterAuth hook does not run because there is still a valid session. We need to properly await the deleting of sessions.

WHAT is this pull request doing?

Test this PR

shopify app init --template=https://github.com/Shopify/shopify-app-template-remix#iphipps\/invalidate-session-on-uninstall
  1. add a console log to an afterAuth hook in app/shopify.server.ts to see when it runs.
  2. notice how the afterAuth hook runs every time you install and uninstall the app on your store

Compare the behavior to main notice how afterAuth is run once.

Checklist