> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuring OAuth for your project

> Get started by configuring your OAuth settings in the Stytch Dashboard.

To use Stytch's OAuth product, you'll first need to complete the following configuration steps in the [Stytch Dashboard](https://stytch.com/dashboard/):

**1. Note your Stytch project's subdomain**

Note the Project Domain from the Project Overview page. You will need this later when setting up your OAuth provider and adjusting your DNS entries.

![Stytch project domain](https://mintcdn.com/stytch-34ca0595/9oHTRL6TP7mU0lre/images/multi-tenant-auth/authentication/oauth/project-domain.png?fit=max\&auto=format\&n=9oHTRL6TP7mU0lre\&q=85\&s=b9dd4cc0b2c8baac6658322cbeaa43cd)

**2. Create an OAuth client**

Navigate to the [OAuth section](https://stytch.com/dashboard/oauth), select the OAuth identity provider of your choice and click **Configure**.

![Stytch OAuth providers](https://mintcdn.com/stytch-34ca0595/9oHTRL6TP7mU0lre/images/multi-tenant-auth/authentication/oauth/oauth-providers.png?fit=max\&auto=format\&n=9oHTRL6TP7mU0lre\&q=85\&s=e24b9cfaa7b7f0bc2843c0de1e0de1fa)

Once in the provider configuration, we recommend clicking the **Setting up OAuth with \[provider]** button to streamline the configuration of your OAuth client.

![Stytch GitHub OAuth configuration](https://mintcdn.com/stytch-34ca0595/ImrCo7c3M8ByeeMn/images/multi-tenant-auth/authentication/oauth/github-oauth-configure.png?fit=max\&auto=format\&n=ImrCo7c3M8ByeeMn\&q=85\&s=35bb047d82582c980d7ae2f67ef49c74)

> [!NOTE]
>
> Be sure to add the **Stytch redirect URI** (`https://{test|live}.stytch.com/v1/b2b/oauth/callback/...`) as an authorized redirect URI in your OAuth provider's settings. This is where end users will be initially redirected after they authenticate with the provider.

**3. Configure redirect URLs in the Stytch Dashboard**

On the [Redirect URLs page](https://stytch.com/dashboard/redirect-urls), you'll need to configure the URL where the user will be redirected after a successful OAuth authentication.

By default, all new projects have redirect URLs set to `http://localhost:3000/authenticate` for Test environments.

If you want to use a different port, update the Dashboard to specify new default Redirect URLs for:

* **Sign-up and Login Redirect URL** (for organization-specific login)
* **Discovery Redirect URL** (for discovery authentication)

**4. (Optional) Create an Organization for Organization-specific authentication**

You can get started with the Discovery (Centralized login flow that allows users to view all Organizations they have access to, including pending invites and Organizations they are allowed to automatically join based on their verified email domain.) sign-up or login flow without this step, so feel free to skip to Step 5!

If you want to start with an example of logging into an existing Organization (Represents an instance or tenant in your application, typically mapping to each of your top-level customers.), you can do so by creating an Organization through the [Stytch Dashboard](https://stytch.com/dashboard) or [Create Organization API](https://stytch.com/docs/api-reference/b2b/api/organizations/create-organization.md).

###### JIT Provisioning by Email Domain

If you are using **Google** or **Microsoft** as OAuth providers, and will be testing using a corporate email, you can allow Just-In-Time (JIT) Provisioning to the Organization via email domain by including your domain in the `email_allowed_domains` array and setting `email_jit_provisioning` to `RESTRICTED`.

```json theme={null}
{
  "organization_id": "${organizationId}",
  "email_allowed_domains": [
    "stytch.com"
  ],
  "email_jit_provisioning": "RESTRICTED"
}
```

![Dashboard page for configuring JIT Provisioning by email domain](https://mintcdn.com/stytch-34ca0595/ImrCo7c3M8ByeeMn/images/multi-tenant-auth/authentication/oauth/jit-email-dashboard.png?fit=max\&auto=format\&n=ImrCo7c3M8ByeeMn\&q=85\&s=d2cc907a3554d980aacd75febf12baad)

> [!NOTE]
>
> Just-in-Time (JIT) Provisioning by email domain is restricted for common, free email providers (e.g. gmail.com). If you don't have a corporate email, you can alternatively create a Member (Represents an individual end user's account within a given Organization, uniquely identified within that Organization by their email address.) in your new Organization with the email you will use to log in.

You can create a Member in the Dashboard by navigating to the Organization and clicking "Create new member" or by calling the [Create Member API](https://stytch.com/docs/api-reference/b2b/api/members/create-member.md).

###### JIT Provisioning by Tenant ID

If you are using **Slack**, **HubSpot**, or **GitHub** as OAuth providers, you can allow JIT Provisioning to the Organization by tenant ID. See our [JIT Provisioning guide](https://stytch.com/docs/multi-tenant-auth/enterprise-ready/org-management/jit-provision-members.md#by-oauth-tenant) for additional information.

> [!NOTE]
>
> Learn more about [step-up flows for Slack/HubSpot/GitHub OAuth](https://stytch.com/docs/multi-tenant-auth/authentication/oauth/overview.md#understanding-step-up-requirements).

**5. Choose your integration approach**

Follow one of the guides below to get an end-to-end OAuth flow up and running:

> [!TIP]
>
> If you want to get up and running with as little code as possible, choose the **pre-built UI** option. If you want fine-grained control over your authentication flow, choose the **custom auth flow** option.

> [card] [Pre-built UI](https://stytch.com/docs/multi-tenant-auth/authentication/oauth/adding-oauth-to-stytch-login.md)
>
> Integrate with Stytch's frontend UI components

> [card] [Custom auth flow](https://stytch.com/docs/multi-tenant-auth/authentication/oauth/adding-to-custom-auth-flow.md)
>
> Build a custom OAuth flow with full control
