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

providers/ory-hydra

Built-in Ory Hydra integration.

OryProfile

Extends

Indexable

[key: string]: any

Properties

amr

amr: string;

Authentication Methods References - methods used to authenticate the user

aud

aud: string;

Audience - the intended recipient of the token (typically the client ID)

email?

optional email: string;

The user’s email address.

email_verified?

optional email_verified: boolean;

Indicates whether the user has verified their email address.

exp

exp: string;

Expiration time - when the token expires (Unix timestamp)

family_name?

optional family_name: string;

The user’s family name.

given_name?

optional given_name: string;

The user’s given name.

iat

iat: string;

Issued at time - when the token was issued (Unix timestamp)

iss

iss: string;

Issuer identifier - the URL of the identity provider that issued the token

jti

jti: string;

JWT ID - a unique identifier for this token

sub

sub: string;

The user’s unique identifier.

username?

optional username: string;

The user’s username.

ver

ver: string;

Version of the token/claims


default()

function default<P>(options): OIDCConfig<P>

Add login with Ory to your app.

Setup

Callback URL

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

Configuration

import Auth from "@auth/core"
import Ory from "@auth/core/providers/ory"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [Ory({
    clientId: ORY_CLIENT_ID,
    clientSecret: ORY_CLIENT_SECRET,
    issuer: ORY_SDK_URL // https://ory.yourdomain.com
  })],
})

Resources

Notes

This set up is optimized for Ory Network, a managed service by Ory. To use Auth.js with self-hosted Ory Hydra, use the OryHydra provider.

The Ory integration is based on the Open ID Connect specification.

💡

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

Disclaimer 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.

Type Parameters

Type Parameter
P extends OryProfile

Parameters

ParameterType
optionsOIDCUserConfig<P>

Returns

OIDCConfig<P>

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