For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Refresh the session

Use the refreshSession method to refresh the user's current auth session. The method returns the updated Web3AuthResponse.

This method is available from v8.

If the refresh fails, the SDK clears the local session: Android signs the user out, and iOS clears the stored response. Treat a failed refresh as signed out, and send the user back to sign in.

Usage​

try {
final Web3AuthResponse response = await Web3AuthFlutter.refreshSession();
final String? privateKey = response.privateKey;
} catch (e) {
// The session couldn't be refreshed and is cleared locally. Ask the user to sign in again.
log(e.toString());
}
On this page