Mobile SDK Auth Helpers
The Auth class is a crucial component of the Descope SDK, handling key user authentication operations. This class is designed to execute essential functions such as fetching user details (me), refreshing a session (refreshSession), and logging out a user (logout).
Client SDK
Install SDK
Import and initialize SDK
Me
Retrieves information about the currently authenticated user. This method is used when you need to fetch or display user-related data in your application.
It requires the refreshJwt
as an argument which is the current refresh token of the user.
This function returns the following details:
loginIds
: An array of loginIds associated to the user.userId
: The user's unique Descope generated userIdverifiedEmail
: Boolean whether the email address for the user has been verified.verifiedPhone
: Boolean whether the phone number for the user has been verified.picture
: The base64 encoded image if the user has an image associated to them.roleNames
: An array of roles associated to the user.userTenants
: An array of tenant names and IDs associated to the user.createTime
: The time that the user was created.totp
: Boolean wether the user has TOTP login associated with it.saml
: Boolean wether the user has SAML login associated with it.oauth
: Boolean wether the user has OAuth login associated with it.
Refresh Session
Refreshes the session of the currently authenticated user. This method is useful when the current user session is about to expire or has expired. By calling this method, you can ensure that the user remains authenticated.
This function takes the current refreshJwt
as an argument.
Logout
Logs out the currently authenticated user. This method invalidates the user's current JWT tokens and ends their session. This function is typically used when the user chooses to log out of your application.
The function takes the current refreshJwt
as an argument.
React Native SDK Methods (useDescope Hook)
The useDescope
hook exposes the underlying Descope SDK instance,
which can be used to call any of the SDK methods directly.
List of a few methods available:
- refresh
- logout
- logoutAll
- me
- oauth
- otp
For a full list, check out the definitions here.