BETTER-AUTH. UI
Mutations

useCreateApiKey

Create an API key for the current user.

Requires the Better Auth API key plugin.

Usage

import { useCreateApiKey } from "@better-auth-ui/solid/plugins/api-key"

const createApiKey = useCreateApiKey(authClient)

createApiKey.mutate({ name: "CLI" })

Options factory

import { createApiKeyOptions } from "@better-auth-ui/core/plugins/api-key"
import { useMutation } from "@tanstack/solid-query"

const createApiKey = useMutation(() => createApiKeyOptions(authClient, userId))

Params

Prop

Type

Last updated on

On this page