UNPKG

@better-auth-ui/core

Version:

Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.

25 lines (24 loc) 1.22 kB
import { MutationOptions } from '@tanstack/query-core'; import { BetterFetchError } from 'better-auth/client'; import { OAuthProviderAuthClient } from './oauth-provider-auth-client'; export type OAuthConsentParams<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = Parameters<TAuthClient["oauth2"]["consent"]>[0]; export type OAuthConsentOptions<TAuthClient extends OAuthProviderAuthClient = OAuthProviderAuthClient> = Omit<ReturnType<typeof oauthConsentOptions<TAuthClient>>, "mutationKey" | "mutationFn">; /** * Mutation options factory for accepting or denying an OAuth request. * * Better Auth reads the signed authorization query from the current URL and * validates the resulting redirect. */ export declare function oauthConsentOptions<TAuthClient extends OAuthProviderAuthClient>(authClient: TAuthClient): MutationOptions<Awaited<ReturnType<(params: OAuthConsentParams<TAuthClient>) => Promise<NonNullable<{ redirect: true; url: string; } | { redirect: boolean; url: string; }>>>>, BetterFetchError, Parameters<(params: OAuthConsentParams<TAuthClient>) => Promise<NonNullable<{ redirect: true; url: string; } | { redirect: boolean; url: string; }>>>[0]>;