Queries
usePublicOAuthClient
Load public metadata for the application requesting OAuth authorization.
Requires oauthProviderClient() from @better-auth/oauth-provider/client. Read the client ID from the signed authorization query and leave the complete query string in the browser URL.
Usage
import { parseOAuthAuthorizationRequest } from "@better-auth-ui/core/plugins"
import { usePublicOAuthClient } from "@better-auth-ui/react"
const { clientId } = parseOAuthAuthorizationRequest(window.location.search)
const client = usePublicOAuthClient(authClient, clientId)The query remains disabled until clientId is available.
Options factory and loader helpers
import {
ensurePublicOAuthClient,
fetchPublicOAuthClient,
prefetchPublicOAuthClient,
publicOAuthClientOptions
} from "@better-auth-ui/react"
const options = publicOAuthClientOptions(authClient, clientId)
await ensurePublicOAuthClient(queryClient, authClient, clientId)
await prefetchPublicOAuthClient(queryClient, authClient, clientId)
const client = await fetchPublicOAuthClient(queryClient, authClient, clientId)Params
Prop
Type
Last updated on