Home > Back-end >  React Stytch has not been loaded
React Stytch has not been loaded

Time:05-26

Recently I get to implement Stytch to a React based application. Implementation is pretty simple and strait forward. However got into an error or bug which become a big road block for me.

I tried Googling to find solution, if not even I find similar so that I can debug myself but unfortunately didn't find any. And the big surprise if Stytch GitHub repo link provided on NPM is invalid too.

The problem I'm facing is, it says:

Stytch has not been loaded.
Make sure the script tag exists in the document head:

<script src="https://js.stytch.com/stytch.js"></script>

If using Next.js be sure to load Stytch using the beforeInteractive strategy in pages/_app.jsx:

import Script from 'next/script';

<Script src="https://js.stytch.com/stytch.js" strategy="beforeInteractive" />

I'm following the Stytch doc here: https://stytch.com/docs/sdks/javascript-sdk/email-magic-links/methods

And created a Sample app here: https://codesandbox.io/s/react-stytch-login-auth-xmf5r4

CodePudding user response:

here is the link just install @stytch/stytch-react using npm.

in the code box you can add through dependencies tab. just make sure you include the script tag in the public/index.html.

  • Related