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

Clerk · Type Alias

OAuthStrategy

OAuthStrategy is Clerk's type for identifying an OAuth strategy. It accepts provider-prefixed OAuth identifiers or a custom OAuth strategy and can be supplied to SignIn or SignUp operations.

How it works

OAuthStrategy is a template-literal type for provider-backed OAuth identifiers, plus Clerk's custom OAuth strategy type. Use it for strategy values passed to authentication operations such as SignIn or SignUp.

Syntax

type OAuthStrategy = `oauth_${OAuthProvider}` | CustomOAuthStrategy

Returns

A TypeScript type accepting oauth_${OAuthProvider} or CustomOAuthStrategy values.

Key points

  • It models the OAuth strategy identifier associated with a provider.
  • Use it as the strategy value when creating a SignIn or SignUp.
  • The declaration combines provider-prefixed OAuth strings with CustomOAuthStrategy.
  • It belongs to Clerk's SSO-related types used by SDK methods.

Common mistakes

  • The import location depends on the SDK: the Electron page directs type-only imports through @clerk/shared/types, while framework SDKs expose a public /types entry point.

Example: Declare a GitHub OAuth strategy

import type { OAuthStrategy } from '@clerk/nextjs/types'

const strategy: OAuthStrategy = 'oauth_github'

This assigns a provider-specific OAuth strategy to a variable while preserving the documented type constraint.

When to use it

Select a standard OAuth provider

A sign-in flow needs to select a configured social provider such as GitHub.

Represent a custom OAuth strategy

An application uses a Clerk-supported custom OAuth integration.

Type strategy configuration

Shared authentication code needs a constrained strategy variable.

Interview questions

QWhat values does OAuthStrategy represent?

OAuthStrategy accepts either a string matching oauth_ followed by an OAuthProvider, or a CustomOAuthStrategy. This allows standard provider strategies and custom OAuth integrations.

Follow-up: Why use a template-literal type here? It constrains the required oauth_ prefix while deriving the provider portion from OAuthProvider, catching malformed strategy strings at compile time.

QWhere is OAuthStrategy used?

The strategy option identifies which OAuth provider flow SignIn or SignUp should use. A value such as oauth_github selects GitHub's OAuth strategy.

Follow-up: How would you apply it? Pass a typed OAuthStrategy value as the strategy field in the relevant SignIn or SignUp call, using the provider identifier expected by Clerk.

QHow should OAuthStrategy be imported?

Import it as a type from the SDK's documented types entry point. The Electron documentation instead specifies @clerk/shared/types and installation of @clerk/shared.

Follow-up: What should be checked before importing? Verify the SDK-specific documentation, because the import path is not uniform across Clerk SDKs.

  • OAuthProvider
  • CustomOAuthStrategy
  • EnterpriseSSOStrategy
  • SignIn
  • SignUp

Source: SSO Types - Next.js. Checked 2026-10-15.