JavaScript: Retrieve a new session

Returns a new session, regardless of expiry status. Takes in an optional current session. If not passed in, then refreshSession() will attempt to retrieve it from getSession(). If the current session's refresh token is invalid, an error will be thrown.

Parameters

Examples

Refresh session using the current session

const \{ data, error \} = await supabase.auth.refreshSession()
const \{ session, user \} = data

Refresh session using a refresh token

const \{ data, error \} = await supabase.auth.refreshSession(\{ refresh_token \})
const \{ session, user \} = data