Session Management
Login Using OAuth
Learn how to authenticate users using OAuth with the Okto SDK.
The loginUsingOAuth()
method authenticates users using OAuth providers. It generates a session key pair, creates an authenticate payload, and sends it to the Gateway service. Upon successful authentication, it updates the user session.
Example
Note
For error handling:
- Use the error code to debug issues. Check out the SDK errors and warnings documentation
- For help, navigate to the troubleshooting guide to contact support
Method Overview
Method | Description |
---|---|
async OktoClient.loginUsingOAuth | Authenticate user using OAuth |
Login Using OAuth
async OktoClient.loginUsingOAuth(data: AuthData)
authenticates users using OAuth providers and establishes their session.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
data | AuthData | Authentication data containing the OAuth provider details | Yes |
Where AuthData
is one of:
Type | Fields | Description |
---|---|---|
Google OAuth | { idToken: string; provider: 'google' } | For authentication using Google OAuth |
Okto Auth | { authToken: string; provider: 'okto' } | For authentication using Okto token |
Response
Success Response
Field Name | Type | Description |
---|---|---|
result | Promise<Address> | Returns the user's Smart Wallet Address on successful login |