Skip to main content

providers/asgardeo

Built-in sign in with Asgardeo integration.

default()​

default(config): OIDCConfig< AsgardeoProfile >

Setup​

Callback URL​

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

Configuration​

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

pages/api/auth/[...nextauth].ts
import NextAuth from "next-auth"
import AsgardeoProvider from "next-auth/providers/asgardeo"

export default NextAuth({
providers: [
AsgardeoProvider({
clientId: process.env.ASGARDEO_CLIENT_ID,
clientSecret: process.env.ASGARDEO_CLIENT_SECRET,
issuer: process.env.ASGARDEO_ISSUER
})
]
})

Configuring Asgardeo​

Follow these steps:

  1. Log into the Asgardeo console
  2. Next, go to "Application" tab (more info here)
  3. Register a standard based, Open ID connect, application
  4. Add the callback URLs: http://localhost:3000/api/auth/callback/asgardeo (development) and https://{YOUR_DOMAIN}.com/api/auth/callback/asgardeo (production)
  5. After registering the application, go to "Protocol" tab.
  6. Check code as the grant type.
  7. Add "Authorized redirect URLs" & "Allowed origins fields"
  8. Make Email, First Name, Photo URL user attributes mandatory from the console.

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

ASGARDEO_CLIENT_ID="Copy client ID from protocol tab here"
ASGARDEO_CLIENT_SECRET="Copy client from protocol tab here"
ASGARDEO_ISSUER="Copy the issuer url from the info tab here"

Resources​

Notes​

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

info

By default, Auth.js assumes that the Asgardeo provider is based on the OAuth 2 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< AsgardeoProfile >

Returns​

OIDCConfig< AsgardeoProfile >


AsgardeoProfile​

The returned user profile from Asgardeo when using the profile callback.

Properties​

email​

email: string

The user email


given_name​

given_name: string

The user name


picture​

picture: string

The user profile picture


sub​

sub: string

The user Asgardeo account ID