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 { useAuth, useListAccounts } from "@better-auth-ui/react"

const { authClient } = useAuth()
const { data: accounts } = useListAccounts(authClient)

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

Options factory

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

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

Invalidation

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

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

Params

Prop

Type

Last updated on

On this page