Skip to content

Instantly share code, notes, and snippets.

@yathindrak
Last active April 11, 2022 15:38
Show Gist options
  • Save yathindrak/f8ca6e5377fd3898519aefdd46c096e2 to your computer and use it in GitHub Desktop.
Save yathindrak/f8ca6e5377fd3898519aefdd46c096e2 to your computer and use it in GitHub Desktop.
Custom asgardeo next-auth provider
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