Fusion Auth
Resources
Setup
Callback URL
https://example.com/api/auth/callback/fusionauth
Environment Variables
AUTH_FUSIONAUTH_ID
AUTH_FUSIONAUTH_SECRET
AUTH_FUSIONAUTH_TENANT_ID
AUTH_FUSIONAUTH_ISSUER
Configuration
/auth.ts
import NextAuth from "next-auth"
import FusionAuth from "next-auth/providers/fusionauth"
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [
FusionAuth({
clientId: process.env.AUTH_FUSIONAUTH_ID,
clientSecret: process.env.AUTH_FUSIONAUTH_SECRET,
tenantId: process.env.AUTH_FUSIONAUTH_TENANT_ID,
issuer: process.env.AUTH_FUSIONAUTH_ISSUER,
}),
],
})
⚠️
If you’re using multi-tenancy, you need to pass in the tenantId option to apply the proper theme.
Notes
- An application can be created at
https://your-fusionauth-server-url/admin/application
In the OAuth settings for your application, configure the following.
- Redirect URL
- 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.