BETTER-AUTH. UI
Mutations

useOAuthConsent

Accept or deny the current OAuth authorization request.

Requires oauthProviderClient() from @better-auth/oauth-provider/client. Better Auth reads and validates the signed authorization query from the current browser URL before completing the redirect.

Usage

import { useOAuthConsent } from "@better-auth-ui/solid/plugins/oauth-provider"

const consent = useOAuthConsent(authClient)

consent.mutate({ accept: true })
consent.mutate({ accept: false })

Pass only the user's decision for the complete requested scope set. The OAuth Provider plugin handles the redirect.

Do not navigate to redirect_uri from the application.

Options factory

import { oauthConsentOptions } from "@better-auth-ui/core/plugins/oauth-provider"
import { createMutation } from "@tanstack/solid-query"

const consent = createMutation(() => oauthConsentOptions(authClient))

consent.mutate({ accept: true })
consent.mutate({ accept: false })

Params

Last updated on

On this page