Last active
April 11, 2022 15:38
-
-
Save yathindrak/f8ca6e5377fd3898519aefdd46c096e2 to your computer and use it in GitHub Desktop.
Custom asgardeo next-auth provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NextAuth from "next-auth" | |
export default NextAuth({ | |
providers: [ | |
{ | |
id: "asgardeo", | |
name: "Asgardeo", | |
type: "oauth", | |
clientId: process.env.ASGARDEO_CLIENT_ID, | |
clientSecret: process.env.ASGARDEO_CLIENT_SECRET, | |
wellKnown: `${process.env.ASGARDEO_SERVER_ORIGIN}/oauth2/token/.well-known/openid-configuration`, | |
authorization: { | |
params: { scope: process.env.ASGARDEO_SCOPES || "openid email profile" } | |
}, | |
idToken: true, | |
checks: ["pkce", "state"], | |
profile(profile) { | |
return { | |
id: profile?.sub, | |
name: profile?.given_name, | |
email: profile?.email | |
} | |
}, | |
httpOptions: { | |
timeout: 40000, | |
}, | |
}, | |
], | |
secret: process.env.SECRET, | |
session: { | |
strategy: "jwt", | |
}, | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment