providers/fushionauth
default()β
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.
- Redirect URL
- https://localhost:3000/api/auth/callback/fusionauth
- Enabled grants
- Make sure Authorization Code is enabled.
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.
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.
default<P>(
options
:OAuthUserConfig
<P
> & {tenantId
?:string
;}):OAuthConfig
<P
>
Type parametersβ
P
extendsFusionAuthProfile
<P
>
Parametersβ
Parameter | Type |
---|---|
options | OAuthUserConfig <P > & {tenantId ?: string ;} |
Returnsβ
OAuthConfig
<P
>
FusionAuthProfileβ
This is the default openid signature returned from FusionAuth it can be customized using lambda functions