Aura Auth
API ReferenceClientFunctions

disconnectProvider

Disconnect an OAuth provider from the current session, from the client.

The disconnectProvider client method disconnects an OAuth provider from the current session, without revoking its access token, from a client-side or browser context.

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

const success = await authClient.disconnectProvider("github")

This is a softer alternative to revokeToken: it disconnects the provider from the session without revoking the access token itself. See revokeToken for the stronger alternative.

Reference

Parameters

ParameterTypeRequiredDescription
providerIdstringYesThe id of the OAuth provider to disconnect.

Returns

Return TypeDescription
Promise<boolean>Resolves to true if the provider was successfully disconnected, false otherwise.

Behavior

  • Cookies are read automatically from the browser context — you don't need to handle them or CSRF tokens manually.
  • The access token itself remains valid until it naturally expires or is separately revoked with revokeToken.
  • If disconnection fails (the provider isn't connected to the current session), the method resolves to false — this does not throw an error, as "not connected" is an expected outcome.

Usage

Disconnect a provider

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

const success = await authClient.disconnectProvider("github")

Handling failure

handle-failure.ts
import { authClient } from "@/lib/auth-client"

const success = await authClient.disconnectProvider("github")

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

On this page