Skip to main content

Authentication Providers

Auth.js supports multiple authentication providers to give your users flexibility in how they sign in to your application. This page documents the providers configured for your portfolio application.

Available Providers​

GitHub Logo

GitHub

Sign in with your GitHub account

Learn More
Google Logo

Google

Sign in with your Google account

Learn More
Auth0 Logo

Auth0

Sign in with your Auth0 account

Learn More
Facebook Logo

Facebook

Sign in with your Facebook account

Learn More
Keycloak Logo

Keycloak

Sign in with your Keycloak account

Learn More
Credentials Logo

Credentials

Sign in with email and password

Learn More

Adding a New Provider​

To add a new authentication provider to your application, follow these steps:

  1. Install the provider package (if needed)
  2. Configure environment variables in .env.local
  3. Add the provider to your Auth.js configuration

Example: Adding a New Provider​

Here's an example of how to add a new provider to your Auth.js configuration:

// In auth.ts
import NewProvider from "next-auth/providers/new-provider"

export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [
// Existing providers...
NewProvider({
clientId: process.env.NEW_PROVIDER_ID,
clientSecret: process.env.NEW_PROVIDER_SECRET,
// Additional provider-specific options
}),
],
// Rest of your configuration
})

Provider Configuration​

Each provider requires specific environment variables to be set in your .env.local file. Refer to the individual provider documentation for details on the required variables.

Provider Callbacks​

Auth.js allows you to customize the behavior of providers through callbacks. These are defined in your Auth.js configuration:

export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [
// Your providers...
],
callbacks: {
async signIn({ user, account, profile }) {
// Custom sign-in logic
return true
},
// Other callbacks...
},
})