Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
descope

providers/descope

Built-in sign in with Descope integration.

DescopeProfile

The returned user profile from Descope when using the profile callback. See Load User

Indexable

[claim: string]: unknown

Properties

email

email: string;

The user’s email

email_verified

email_verified: boolean;

A boolean indicating if the user’s email is verified

name

name: string;

The user’s name

phone_number

phone_number: string;

The user’s phone number

phone_number_verified

phone_number_verified: boolean;

A boolean indicating if the user’s phone number is verified

picture

picture: string;

The user’s picture

sub

sub: string;

The user’s unique Descope ID


default()

default(config): OIDCConfig<DescopeProfile>

Setup

Callback URL

https://example.com/api/auth/callback/descope

Configuration

Import the provider and configure it in your Auth.js initialization file:

pages/api/auth/[...nextauth].ts
import NextAuth from "next-auth"
import DescopeProvider from "next-auth/providers/descope";
 
export default NextAuth({
 providers: [
   DescopeProvider({
     clientId: process.env.DESCOPE_ID,
     clientSecret: process.env.DESCOPE_SECRET,
   }),
 ],
})

Configuring Descope

Follow these steps:

  1. Log into the Descope console
  2. Follow the OIDC instructions

Then, create a .env.local file in the project root add the following entries:

Get the following from the Descope’s console:

DESCOPE_ID="<Descope Issuer's last url segment>" # Descope's Issuer can be found in "Authentication Methods > SSO > Identity Provider" (Can also be taken from "Project > Project ID")
DESCOPE_SECRET="<Descope Access Key>" # Manage > Access Keys

Resources

Notes

The Descope provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

By default, Auth.js assumes that the Descope provider is based on the OIDC spec

Help

If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Parameters

ParameterType
configOIDCUserConfig<DescopeProfile>

Returns

OIDCConfig<DescopeProfile>

Auth.js © Balázs Orbán and Team - 2024