Skip to content

Integration with NextAuth.js

Follow this guide to set up NextAuth.js.

In your pages/api/auth/[...nextauth].js file, configure the e-Próspera provider as follows:

javascript
import NextAuth from "next-auth"
import GithubProvider from "next-auth/providers/github"

export const authOptions = {
  // Configure one or more authentication providers
  providers: [
    {
      id: "eprospera",
      name: "eProspera",
      type: "oauth",
      wellKnown:
        "https://portal.eprospera.com/.well-known/openid-configuration",
      authorization: { params: { scope: "openid email profile" } },
      idToken: true,
      checks: ["pkce", "nonce", "state"],
      profile(profile) {
        return {
          id: profile.sub,
          name: profile.name,
          email: profile.email,
          image: profile.picture,
        };
      },
      options: {
        clientId: process.env.EPROSPERA_CLIENT_ID,
        clientSecret: process.env.EPROSPERA_CLIENT_SECRET,
      },
    },
    // ...add more providers here
  ],
}

export default NextAuth(authOptions)

To get a CLIENT_ID and a CLIENT_SECRET, reach out to louis@prospera.hn.