Aura Auth
API ReferenceClientFunctions

refreshUserInfo

Refresh the current user's profile data from a connected provider, from the client.

The refreshUserInfo client method refreshes the current user's profile data from a connected provider, without requiring re-authentication, from a client-side or browser context.

refresh-user-info.ts
import { authClient } from "@/lib/auth-client"

const userInfo = await authClient.refreshUserInfo("github")

Reference

Parameters

ParameterTypeRequiredDescription
providerIdstringYesThe id of the OAuth provider to refresh user info from.

Returns

| Return Type | Description | | ----------------------------- | ----------- | ------------------------------------------------------------------------------------ | | Promise<Session<DefaultUser> | null> | Resolves to the refreshed session object on success or null when refreshing fails. |

Behavior

  • Cookies are read automatically from the browser context — you don't need to handle them or CSRF tokens manually.
  • Uses the provider's existing access token to fetch fresh profile data and normalizes it into the session's User object, matching api.refreshUserInfo's behavior.
  • If the refresh fails (invalid or expired access token, or the provider request fails), the function returns null. On success it returns the refreshed session object.

Usage

Refresh user info

refresh-user-info.ts
import { authClient } from "@/lib/auth-client"

const userInfo = await authClient.refreshUserInfo("github")

console.log("refreshed session:", session)

Handling failure

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

const userInfo = await authClient.refreshUserInfo("github")

if (!userInfo) {
  window.location.assign("/login")
}

console.log("refreshed session:", session)

On this page