useDeleteOAuthConsent
Remove a stored OAuth consent record.
Requires oauthProviderClient() from @better-auth/oauth-provider/client.
Usage
import { useAuth, useDeleteOAuthConsent } from "@better-auth-ui/react"
const { authClient } = useAuth()
const { mutateAsync: deleteConsent } = useDeleteOAuthConsent(authClient)
for (const id of application.consentIds) {
await deleteConsent({ id })
}Better Auth can store more than one consent record per OAuth client. Group the records with groupOAuthConsents and delete every ID in the group so the application really has to ask again.
Deleting a consent removes the stored approval, so the application needs the user's approval before it receives new access. It does not revoke access tokens or refresh tokens that were already issued — those stay valid until they expire. Better Auth's consent deletion endpoint does not offer complete token revocation semantics, so don't tell users their access was cut off.
On success the user's consent list is invalidated and refetched, so a removal that fails halfway still shows the server's real state.
Options factory
import { deleteOAuthConsentOptions } from "@better-auth-ui/react"
const options = deleteOAuthConsentOptions(authClient)Params
Prop
Type
Last updated on