Select a standard OAuth provider
A sign-in flow needs to select a configured social provider such as GitHub.
Clerk · Type Alias
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.
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.
type OAuthStrategy = `oauth_${OAuthProvider}` | CustomOAuthStrategyA TypeScript type accepting oauth_${OAuthProvider} or CustomOAuthStrategy values.
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.
A sign-in flow needs to select a configured social provider such as GitHub.
An application uses a Clerk-supported custom OAuth integration.
Shared authentication code needs a constrained strategy variable.
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.
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.
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.
OAuthProviderCustomOAuthStrategyEnterpriseSSOStrategySignInSignUp