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.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
| providerId | string | Yes | The id of the OAuth provider to check the connection for. |
Returns
| Return Type | Description |
|---|---|
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
trueorfalse. 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
falserather than throwing an error. This is to avoid exposing session state to the client.
Usage
Check a provider's connection status
import { authClient } from "@/lib/auth-client"
const connected = await authClient.isProviderConnected("github")Prompting the user to connect a provider
import { authClient } from "@/lib/auth-client"
const connected = await authClient.isProviderConnected("github")
if (!connected) {
window.location.assign("/settings/connections/github")
}