Aura Auth
API ReferenceClientFunctions

isProviderConnected

Check whether the current session has an active connection with a specific OAuth provider, from the client.

The isProviderConnected client method checks whether the current session has an active connection with a specific OAuth provider, from a client-side or browser context.

is-provider-connected.ts
import { authClient } from "@/lib/auth-client"

const connected = await authClient.isProviderConnected("github")

This only checks connection status — it doesn't return token data. If you need the access token, use getAccessToken instead.

Reference

Parameters

ParameterTypeRequiredDescription
providerIdstringYesThe id of the OAuth provider to check the connection for.

Returns

Return TypeDescription
Promise<boolean>Resolves to a boolean indicating whether the provider is connected.

Behavior

  • Cookies are read automatically from the browser context — you don't need to handle them or CSRF tokens manually.
  • On success, the method resolves to true or false. This does not throw for "not connected" — that's an expected outcome.
  • If the check itself fails (e.g. no valid session), the method resolves to false rather than throwing an error. This is to avoid exposing session state to the client.

Usage

Check a provider's connection status

is-provider-connected.ts
import { authClient } from "@/lib/auth-client"

const connected = await authClient.isProviderConnected("github")

Prompting the user to connect a provider

connect-prompt.ts
import { authClient } from "@/lib/auth-client"

const connected = await authClient.isProviderConnected("github")

if (!connected) {
  window.location.assign("/settings/connections/github")
}

On this page