stytch-go-magic-links

This is a lightweight Stytch + Go example app which demonstrates a quick Stytch implementation using our Email Magic Links and Sessions products.

stytch

Running locally

Set up

In the Stytch Dashboard

  1. Create a Stytch account. Once your account is set up a Project called "My first project" will be automatically created for you.

  2. Navigate to Redirect URLs, and add http://localhost:3000/authenticate as the types Login and Sign-up.

  3. Finally, navigate to API Keys, and copy your project_id and secret. You will need these value later on.

On your machine

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

Running locally

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!

Next steps

This example app showcases a small portion of what you can accomplish with Stytch. Here are a few ideas to explore:

  1. Add additional login methods like Passwords or Passcodes.
  2. Secure your app further by building MFA authentication using methods like WebAuthn.

Get help and join the community

💬 Stytch community Slack

Join the discussion, ask questions, and suggest new features in our ​Slack community!

❓ Need support?

Check out the Stytch Forum or email us at support@stytch.com.