Mutations
useSignInUsername
Username/password sign-in mutation.
Resets the session query on success so the new session is refetched.
Usage
import {
type UsernameAuthClient,
useAuth,
useSignInUsername
} from "@better-auth-ui/react"
const { authClient } = useAuth()
const { mutate: signInUsername } = useSignInUsername(
authClient as UsernameAuthClient
)
signInUsername({
username: "alice",
password: "hunter2"
})useSignInUsername requires the Better Auth username plugin. Cast authClient to UsernameAuthClient so TypeScript picks up the plugin-extended method signature.
Options factory
import { signInUsernameOptions } from "@better-auth-ui/react"
import { useMutation } from "@tanstack/react-query"
const { mutate } = useMutation(signInUsernameOptions(authClient))Params
Prop
Type
Last updated on