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

Auth.js · Const

Apple

Auth.js provides a built-in Apple OAuth provider. Add Apple to the providers array and configure AUTH_APPLE_ID plus AUTH_APPLE_SECRET.

How it works

Apple is a built-in OAuth provider for Auth.js. Add the provider to the providers array, configure the required environment variables, and use the provider’s callback endpoint for the Apple developer configuration.

Syntax

Apple

Key points

  • Auth.js includes Apple as a built-in sign-in integration.
  • The provider reads AUTH_APPLE_ID and AUTH_APPLE_SECRET as its documented environment variables.
  • Next.js applications use an Apple callback URL ending in /api/auth/callback/apple.
  • The built-in provider supplies default OAuth settings, which can be overridden when needed.

Common mistakes

  • Do not use Auth.js redirect-proxy deployments with Apple.
  • Apple sign-in requires a live HTTPS URL rather than localhost or plain HTTP.
  • The Apple client secret must be a JWT; Auth.js provides a CLI helper to generate one.
  • Persist the initial profile data because Apple may not provide the name and email again.

Example: Configure Apple sign-in

import NextAuth from "next-auth"
import Apple from "next-auth/providers/apple"

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [Apple],
})

Register the built-in Apple provider in a NextAuth configuration; supply AUTH_APPLE_ID and AUTH_APPLE_SECRET in the environment.

When to use it

Apple ID sign-in

Users authenticate through Apple ID in a Next.js application.

Managed OAuth setup

An application needs a built-in OAuth integration without implementing Apple’s protocol itself.

Multi-provider authentication

A project supports multiple Auth.js providers and wants Apple alongside them.

Interview questions

QHow is Apple added to an Auth.js configuration?

Import Apple from the framework-specific provider package and include Apple in the Auth.js providers array. The standard environment variables are AUTH_APPLE_ID and AUTH_APPLE_SECRET.

Follow-up: What callback URL should be registered? Use the application’s HTTPS callback endpoint, such as https://example.com/api/auth/callback/apple for Next.js.

QWhat callback URL does Apple use?

Apple uses the callback path ending in /callback/apple. In a Next.js application, the documented form is https://example.com/api/auth/callback/apple.

Follow-up: What deployment restriction applies? Apple does not support localhost or HTTP callback URLs, so the registered URL must be a live HTTPS URL.

QWhat makes Apple’s client secret and profile behavior special?

The client secret is not an ordinary static password: Apple requires it to be a JWT. The documented npx auth add apple command can help generate the required credentials and write the environment variables.

Follow-up: Why should the initial profile be stored? Apple supplies the user’s name and email only on the first consent, so later sign-ins may omit them.

  • OAuthUserConfig
  • AppleProfile
  • OAuthConfig
  • customizing a built-in OAuth provider

Source: Apple Provider. Checked 2026-10-15.