BETTER-AUTH. UI
Queries

useListAccounts

Retrieve the current user's linked social accounts.

Keyed per-user. Waits for the active session before firing.

Usage

import { authClient } from "@/lib/auth-client"
import { useListAccounts } from "@better-auth-ui/react"

const { data: accounts } = useListAccounts(authClient)

// With React Query options
const { data: accounts } = useListAccounts(authClient, { refetchOnMount: false })

Options factory

import { listAccountsOptions } from "@better-auth-ui/core"
import { useQuery } from "@tanstack/react-query"

const { data: accounts } = useQuery(listAccountsOptions(authClient, userId))

Invalidation

import { listAccountsOptions } from "@better-auth-ui/core"

queryClient.invalidateQueries({
  queryKey: listAccountsOptions(authClient, userId).queryKey
})

Params

Prop

Type

Last updated on

On this page