BETTER-AUTH. UI
Mutations

useLinkSocial

Link a social provider to the current user.

Kicks off the OAuth redirect — the linked account appears in useListAccounts after the provider redirects back.

Usage

import { useAuth, useLinkSocial } from "@better-auth-ui/react"

const { authClient } = useAuth()
const { mutate: linkSocial } = useLinkSocial(authClient)

linkSocial({
  provider: "github",
  callbackURL: "/account"
})

Options factory

import { linkSocialOptions } from "@better-auth-ui/react"
import { useMutation } from "@tanstack/react-query"

const { mutate } = useMutation(linkSocialOptions(authClient))

Params

Last updated on

On this page