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

Auth.js · Const

Instagram

Auth.js provides a built-in Instagram OAuth integration. Configure it with an Instagram client ID and client secret, then register the documented callback URL.

How it works

Calling the Instagram provider with client credentials creates an OAuth configuration that Auth.js can use in its providers list. The provider uses OAuth 2 by default, and its callback endpoint must be registered with the provider. Instagram does not supply an email address through its API.

Syntax

function default(config): OAuthConfig<Record<string, any>>

Parameters

NameTypeDescription
configOAuthUserConfig<Record<string, any>>Provider configuration, including the OAuth client credentials and any supported overrides.

Returns

OAuthConfig<Record<string, any>>

Key points

  • Auth.js includes Instagram as a built-in provider rather than requiring a custom OAuth implementation.
  • The documented callback path uses the provider identifier instagram.
  • The setup requires an Instagram client ID.
  • The setup also requires an Instagram client secret.
  • Auth.js treats this provider as OAuth 2 unless its defaults are customized.

Common mistakes

  • Do not assume that the Instagram profile contains an email address.
  • Local development callbacks require HTTPS; use local SSL or a proxy such as ngrok.
  • Register the callback URL in the associated Facebook app before testing sign-in.

Example: Configure Instagram login

import { Auth } from "@auth/core"
import Instagram from "@auth/core/providers/instagram"

const request = new Request("https://example.com")
const response = await Auth(request, {
  providers: [
    Instagram({
      clientId: process.env.INSTAGRAM_CLIENT_ID!,
      clientSecret: process.env.INSTAGRAM_CLIENT_SECRET!,
    }),
  ],
})

Registers Instagram as an OAuth provider in an Auth.js configuration.

When to use it

Social authentication

Offer Instagram as a social sign-in option in an Auth.js application.

Built-in provider setup

Use Auth.js’s predefined OAuth settings instead of implementing Instagram endpoints manually.

OAuth customization

Adjust provider behavior when the default Instagram OAuth configuration does not fit an application.

Interview questions

QHow do you configure Instagram in Auth.js?

Use the built-in Instagram provider and pass its client ID and client secret to the provider function. Add the resulting configuration to Auth.js’s providers list.

Follow-up: What callback endpoint should be registered? Use the application’s callback route ending in /api/auth/callback/instagram for the documented example.

QWhat protocol and return type does the provider use?

The provider assumes Instagram follows OAuth 2 by default. Its factory returns an OAuth configuration that Auth.js can consume.

Follow-up: How can defaults be changed? Supply additional provider options to override the built-in OAuth configuration.

QWhat data and development constraint should you account for?

Instagram’s API does not return an email address, so application logic and account handling must not require one from this provider.

Follow-up: What local callback constraint must be handled? Facebook requires HTTPS even on localhost, so configure local TLS or use a proxy.

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

Source: Instagram - Auth.js. Checked 2026-10-15.