Gatsby ↔️ Stytch Migration Guide
This guide is only relevant for @chordcommerce/gatsby-theme-autonomy<4.0.0
Create your Stytch account following our Stytch Account Setup guide.
You can find your public token in the Stytch dashboard.
Also remove the magic key from your .env if you have one.
Create a new file called "AuthProvider" and paste the following code:
Then wrap element in your gatsby-browser.js file with the AuthProvider:
Go to the config docs to see what options are available.
This component will authenticate the user by calling handleCallback() from useAuth, then it will navigate to the /account page.
Add this component to the pages directory:
Visit your login page and try logging in using a magic link!
Once you've clicked the link in the email from Stytch to sign-up/login, you can visit the user management page to see your user.
If your would like to enable OAuth, visit the SDK Configuration page, and click the OAuth toggle. Then, expand the OAuth section and toggle Enable PKCE.
Once OAuth is enabled, visit the OAuth page, then select the provider you would like to use and follow the directions.