BETTER-AUTH. UI
Mutations

useVerifyDeviceCode

Verify and claim a device user code for the current session.

Requires deviceAuthorizationClient() from better-auth/client/plugins. Verification is modeled as a mutation because it claims the code for the signed-in session, even though Better Auth exposes the underlying endpoint through authClient.device.

Usage

import { useVerifyDeviceCode } from "@better-auth-ui/react"

const verifyDeviceCode = useVerifyDeviceCode(authClient)

verifyDeviceCode.mutate({
  query: {
    user_code: "ABCD1234"
  }
})

The returned status indicates whether the request still needs approval or has already been approved or denied.

Options factory

import { verifyDeviceCodeOptions } from "@better-auth-ui/react"

const options = verifyDeviceCodeOptions(authClient)

Params

Prop

Type

Last updated on

On this page