This example app uses the Stytch React component to send Email Magic Links and a server to authenticate magic links. This repo contains two implementations of the same server written in Node and Python.
In order to use this app, you'll need to build the frontend and start the backend server.
- Copy the .env_template to your own .env file (
cp .env_template .env
) - Fill in the placeholder values for
STYTCH_PROJECT_ID
,STYTCH_SECRET
, andREACT_APP_STYTCH_PUBLIC_TOKEN
in your .env file. Get your Stytch API credentials from the API keys in your Stytch dashboard. - Add
http://localhost:3000/authenticate
as a valid sign-up and login redirect URL on your Stytch Dashboard. - Configure the Stytch JavaScript SDK by visiting the Stytch Dashboard:
- Add
http://localhost:3000
as an authorized domain. - Enable the LoginOrCreate option for Email Magic Links.
- Add
Build the client and run a Node server by running ./quickstart.sh
. Run ./quickstart.sh --help
to see all the server options.
Visit http://localhost:3000 to see the example app.
To build the client by itself, follow these instructions:
- Make sure you have node installed:
brew install node
- Install dependencies:
npm install
- Build the frontend files from the client directory. Note: You'll need to rebuild your files to reflect any changes you want to make.
$ cd client $ npm run build
- This example app serves the frontend when you run a backend server. Click on the links under Supported server languages to go to the readme for your preferred language.
To run the server by itself, navigate to the setup instructions for the backend you want to use: