providers/asgardeo
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:
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:
- Log into the Asgardeo console
- Next, go to "Application" tab (more info here)
- Register a standard based, Open ID connect, application
- Add the callback URLs:
http://localhost:3000/api/auth/callback/asgardeo
(development) andhttps://{YOUR_DOMAIN}.com/api/auth/callback/asgardeo
(production) - After registering the application, go to "Protocol" tab.
- Check
code
as the grant type. - Add "Authorized redirect URLs" & "Allowed origins fields"
- 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.
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β
βͺ config: OIDCUserConfig
< AsgardeoProfile
>
Returnsβ
AsgardeoProfileβ
The returned user profile from Asgardeo when using the profile callback.
Extendsβ
Record
<string
,any
>
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