createOAuthClient()
Creates an OAuth client configuration for the specified app slug.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function createOAuthClient(oauthAppSlug: string) { const client = await wachtClient(); return client.oauth.createOAuthClient(oauthAppSlug, { client_auth_method: 'client_secret_basic', grant_types: ['authorization_code'], redirect_uris: ['https://example.com/callback'], });}Signature
function createOAuthClient( oauthAppSlug: string, request: CreateOAuthClientRequest,): Promise<OAuthClient>CreateOAuthClientRequest
›oauthAppSlug?: string | undefined;
oauthAppSlug?: string | undefined;Parent OAuth app slug.
›client_auth_method?: string | undefined;
client_auth_method?: string | undefined;Client authentication method.
›grant_types?: string[] | undefined;
grant_types?: string[] | undefined;Allowed OAuth grant types.
›redirect_uris?: string[] | undefined;
redirect_uris?: string[] | undefined;Allowed redirect URIs.
›scope?: string | undefined;
scope?: string | undefined;Optional default scope string.
›client_name?: string | undefined;
client_name?: string | undefined;Optional client display name.
Return value
›id?: string | undefined;
id?: string | undefined;Created OAuth client id.
›client_auth_method?: string | undefined;
client_auth_method?: string | undefined;Configured auth method.
›grant_types?: string[] | undefined;
grant_types?: string[] | undefined;Configured grant types.
›redirect_uris?: string[] | undefined;
redirect_uris?: string[] | undefined;Configured redirect URIs.
›scope?: string | undefined;
scope?: string | undefined;Configured default scope string.
Behavior
- Creates a client configuration bound to the specified OAuth app.
- The client id in the response is required for grant inspection and revocation calls.
Security notes
- Make sure redirect URIs are exact and environment-specific.
- Choose grant types and auth method intentionally to match your deployment policy.