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

providers/fusionauth

Built-in FusionAuth integration.

FusionAuthProfile

This is the default openid signature returned from FusionAuth it can be customized using lambda functions

Extends

  • Record<string, any>

Properties

at_hash

at_hash: string;

aud

aud: string;

authenticationType

authenticationType: string;

c_hash

c_hash: string;

email

email: string;

email_verified

email_verified: boolean;

exp

exp: number;

iat

iat: number;

iss

iss: string;

jti

jti: string;

preferred_username

preferred_username: string;

scope

scope: string;

sid

sid: string;

sub

sub: string;

default()

default<P>(options): OAuthConfig<P>

Add FusionAuth login to your page.

Setup

Callback URL

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

Configuration

import Auth from "@auth/core"
import FusionAuth from "@auth/core/providers/fusionauth"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [FusionAuth({ clientId: FUSIONAUTH_CLIENT_ID, clientSecret: FUSIONAUTH_CLIENT_SECRET, tenantId: FUSIONAUTH_TENANT_ID, issuer: FUSIONAUTH_ISSUER })],
})
⚠️

If you’re using multi-tenancy, you need to pass in the tenantId option to apply the proper theme.

Resources

Notes

By default, Auth.js assumes that the FusionAuth provider is based on the OAuth 2 specification.

Configuration

💡

An application can be created at https://your-fusionauth-server-url/admin/application.

For more information, follow the FusionAuth 5-minute setup guide.

In the OAuth settings for your application, configure the following.

If using JSON Web Tokens, you need to make sure the signing algorithm is RS256, you can create an RS256 key pair by going to Settings, Key Master, generate RSA and choosing SHA-256 as algorithm. After that, go to the JWT settings of your application and select this key as Access Token signing key and Id Token signing key.

💡

The FusionAuth 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 FusionAuthProfile

Parameters

ParameterType
optionsOAuthUserConfig<P> & { tenantId: string; }

Returns

OAuthConfig<P>

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