This is a lightweight Stytch + Go example app which demonstrates a quick Stytch implementation using our Email Magic Links and Sessions products.
-
Create a Stytch account. Once your account is set up a Project called "My first project" will be automatically created for you.
-
Navigate to Redirect URLs, and add
http://localhost:3000/authenticate
as the types Login and Sign-up. -
Finally, navigate to API Keys, and copy your
project_id
andsecret
. You will need these value later on.
In your terminal, clone the project and install dependencies:
git clone https://github.com/stytchauth/stytch-go-magic-links.git
cd stytch-go-magic-links
go get
Next, create a .env.local
file by running the command below and replacing the keys with those copied from step 3 above.
cp .env.template .env.local
# Replace your keys in new .env.local file with the API keys from step 3 above
After completing all the set up steps above the application can be run with the command:
go run main.go
The application will be available at http://localhost:3000
and you'll be able to login with Email Magic Links!
To do so, enter your email, then check for the Stytch email and click the sign in button.
You should be signed in!
This example app showcases a small portion of what you can accomplish with Stytch. Here are a few ideas to explore:
- Add additional login methods like Passwords or Passcodes.
- Secure your app further by building MFA authentication using methods like WebAuthn.
Join the discussion, ask questions, and suggest new features in our Slack community!
Check out the Stytch Forum or email us at support@stytch.com.