> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/chord-oms/developer-tools/authentication/stytch/stytch-account-setup.md).

# Stytch Account Setup

## Stytch Account Setup

## Step 1: Create Your Account

You, as the customer, are completely in control of your Stytch account. By working with Chord, we can offer you a service credit of $1,000. To see if you are elgible, [fill out this form](https://2fg5qsh42x8.typeform.com/to/HhoMRb6q?utm_source=partnership\&utm_medium=referral). If you have any questions please reach out [Brandon Huang](mailto:brandon@stytch.com).

Otherwise, visit [Stytch](https://stytch.com/start-now) and follow the steps to create an account.

## Step 2: Configure The Stytch Project

#### 1. Add [Redirect URLs](https://stytch.com/dashboard/redirect-urls)

You will need to add a redirect URL for each callback location you plan to use. This is the URL that Stytch will navigate to when the user clicks the link from their email.

We recommend using [www.your-site.com/authenticate](http://www.your-site.com/authenticate). You will need to add a redirect URL for each action you would like to use. (Login, Sign-up, Invite, and Reset Password)

For example, if you want to allow users to login or sign-up for an account on <http://localhost:3000>, you need to add <http://localhost:3000/authenticate> to the Login and the Sign-up sections.

![](https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-02a9673a934e71e7654c886eb914c74c467a4046%2Fstytch-account-setup-1.png?alt=media)

{% hint style="info" %}
One thing to note is that Stytch segregates it's test and production level accounts. For security purposes, you should have your non-production domains in the test environment and your production domains in the live environment.
{% endhint %}

#### 2. [SDK Configuration](https://stytch.com/dashboard/sdk-configuration)

First, click the "Enable SDK" button and select "Enable" on the confirmation dialogue.

![](https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-fe78862dafd777c80a3829dcda38579cb8ccc3e6%2Fstytch-account-setup-2.png?alt=media)

Second, expand the "Domains" section and add the base domains that you added to the redirect URLs. (In our example, <http://localhost:3000>)

![](https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-90974dcd723db4afc236acb66f03fe8b8e68e9a8%2Fstytch-account-setup-3.png?alt=media)

Third, expand the "Email magic links" section and toggle on Enable the LoginOrCreate Flow, Enable the Send Flow, and Enable PKCE.

![](https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-5a5147d8ee8090ec6af247f44e7d3b5d54056d07%2Fstytch-account-setup-4.png?alt=media)

Finally, if you would like enable OAuth login methods for the SDK, you can do that now.

![](https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-40f7fa8ed18fd6292600880fb3bf6dfb13d82a54%2Fstytch-account-setup-5.png?alt=media)

{% hint style="info" %}
**It should be noted that you will need to do these steps for both the test and live environments!**
{% endhint %}

#### 3. Configure Session Length

Stytch has a configurable max session length. It defaults to 60 minutes, which we at Chord feel is way too short, given the limited scope that authentication confers for Chord's customer endpoints. The maximum that Stytch allows is 90 days and can be configured per environment, which allows for more rapid logouts as a part of development without impacting your customers.

<figure><img src="https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-97a35f6b5ae63c89c9c50998aabca69c56c7643c%2Fstytch-account-setup-6.png?alt=media" alt=""><figcaption><p>This is in the SDK section of the admin panel</p></figcaption></figure>

{% hint style="warning" %}
Please note that this is the maximum session duration and that you must also set this limit when initializing chord-stytch.
{% endhint %}

#### 4. (Optional) [Configure OAuth](https://stytch.com/dashboard/oauth)

If you would like to provide your customers with the ability to login with services like Google, Facebook, Amazon and many more, Stytch offers a beavy of OAuth login options that can be easily integrated into your login form.

To set it up, follow the instructions that Stytch provides you as a part of their OAuth provider onboarding flows.

![](https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-dd60d7c6b737643c76ab833540c34554e29532b4%2Fstytch-account-setup-7.png?alt=media)

## Step 3: Configure Chord OMS To Use Stytch

In order for your customers to use Stytch authentication, you must provide Stytch's keys as environment variables. These variables can be added at any time, as a seperate environment variable controls with authentication method is used.

To set environment variables in the OMS, login to the OMS and navigate to `Settings > Stores` and the environment variables are at the bottom of the page.

The environment variables you must set are:

* `AUTH_PROVIDER` - set to `stytch` when you are ready to go live with Stytch
* `STYTCH_ENV` - must be either `test` or `live`
* `STYTCH_PROJECT_ID` - the project ID for the environment, which can be found [here](https://stytch.com/dashboard/api-keys)
* `STYTCH_SECRET` - the secret key for the environment, which can be found [here](https://stytch.com/dashboard/api-keys)

![](https://3559351341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGejRW1RLC9yasX56Xzxu%2Fuploads%2Fgit-blob-21b45a88f1f3b38dad2b3547ed33c6718a7d18b2%2Fstytch-account-setup-8.png?alt=media)

## Step 4: Integrate Stytch Into Your Chord Storefront

We have serveral guides on how to integrate/migrate Stytch into your storefront.

* [Next.js ↔️ Stytch Migration Guide](/chord-oms/developer-tools/authentication/stytch/stytch-migration-guides/next-js-stytch-migration-guide.md)
* [Gatsby ↔️ Stytch Migration Guide](/chord-oms/developer-tools/authentication/stytch/stytch-migration-guides/gatsby-stytch-migration-guide.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/chord-oms/developer-tools/authentication/stytch/stytch-account-setup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
