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

Get access token

The getAccessToken method returns the access token of the current Web3Auth session.

This method throws Web3AuthError.noUserFound if no access token is available, for example when no user is signed in.

note

This method isn't available for users who signed in with an idToken (single-factor authentication). SFA sign-in doesn't create session tokens, so the method throws Web3AuthError.noUserFound.

Usage​

do {
let accessToken = try await web3Auth.getAccessToken()
} catch {
print(error.localizedDescription)
// Handle error
}
On this page