Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Auth.js · Pipe

providers

providers is the Auth.js configuration array that enables authentication integrations. Add built-in provider definitions or custom OAuth/OIDC provider objects to make them available for sign-in.

How it works

Auth.js receives providers through the providers configuration array. Each entry is typically a built-in provider function or a custom provider object; built-ins supply defaults, while custom configuration can override options such as credentials, issuer, or authorization parameters.

Syntax

NextAuth({ providers: [Provider, ...] })

Parameters

NameTypeDescription
providersProvider[]Array of enabled provider definitions, usually imported built-in providers or custom OAuth/OIDC provider objects.

Returns

No standalone return value; the configured providers become available through Auth.js authentication routes and sign-in flows.

Key points

  • Auth.js includes a large catalog of ready-made integrations, so check built-in providers before implementing one yourself.
  • A provider does not need to be in the built-in catalog if it follows OAuth or OpenID Connect standards.
  • Custom integrations are registered by adding a provider object to the providers array.
  • Use oidc for OpenID Connect integrations and oauth for OAuth 2 providers.
  • For OIDC, an issuer lets Auth.js locate the provider's well-known discovery document.
  • Built-in provider settings can be selectively overridden when the provider is called.

Common mistakes

  • Built-in providers still require the provider-specific credentials, normally a client ID and client secret.
  • An OAuth or OIDC provider must be configured with the callback URL generated from its provider ID.

Example: Register GitHub as a provider

import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"

export const { handlers, auth } = NextAuth({
  providers: [GitHub],
})

Import a built-in provider and register it in the Auth.js configuration.

When to use it

Built-in provider setup

Enable a ready-made OAuth integration such as GitHub, Google, or Auth0.

Provider customization

Adjust scopes, authorization parameters, or other defaults for a built-in provider.

Custom provider integration

Connect an OAuth 2 or OIDC service that is not included in the built-in catalog.

Interview questions

QWhat is the purpose of the providers configuration?

The providers option is an array in the Auth.js configuration. It contains enabled authentication integrations, such as GitHub, and Auth.js uses those entries to expose the corresponding sign-in options.

Follow-up: How would you customize a built-in provider? Pass options to its provider function; Auth.js merges those options with the built-in defaults.

QHow do you configure a built-in OAuth provider?

For a built-in OAuth provider, import the provider from the framework-specific next-auth/providers package and place it in the array. Configuration commonly supplies a client ID and client secret through environment variables.

Follow-up: What if no built-in provider fits? Define a custom provider object with an ID, name, type, issuer or OAuth settings, and client credentials.

QWhat fields matter when defining a custom provider?

A custom provider object must identify itself with an id and name, and specify an OAuth or OIDC type. OIDC providers can use an issuer so Auth.js can discover the provider's configuration.

Follow-up: Why is the provider ID significant? It is used by signIn and becomes part of the callback URL, so changing it affects integration configuration.

  • OAuth Providers
  • Configuring OAuth Providers
  • ProviderType
  • GitHub Provider
  • AuthConfig

Source: Configuring Oauth Providers. Checked 2026-10-15.