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.
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 |
---|---|---|
data | AuthData | Authentication data containing the OAuth provider details |
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<User> | Returns the user data on successful login |
Note
In case of errors, debug the error using the error code and refer to the SDK errors and warnings documentation for more details.