Session Management
The Session Management feature in Auth + Embedded Wallet simplifies account management, authentication, and session control for your application.
A valid session is opened during the Authentication process.
Sequence Auth and Embedded Wallet handles the following aspects of your application:
- Check Valid Session: Manage blockchain accounts to sign up or sign in users.
- Control Session Validation: Authentication sessions to return important details to be consumed by your application to enhance the experience of games and applications.
- Close Session: Manage the listing and dropping of sessions handled by the WaaS stack.
Validation status
To check the validation status of the current session, use the isSessionValid
method. This returns true
for email login and trusted social logins and false
for custom logins until email validation is complete.
Trigger session validation
Manually trigger a session validation with the validateSession
method. This will send a code to the user’s email. If validated within 10 minutes, the method returns true
; otherwise, it returns false
.
Once user receives the code, he can validate the session with the finishValidateSession
method that takes the code as an argument. If the code is valid, the method returns true
; otherwise, it returns false
.
Control Session Validation
The onValidationRequired
callback is used to determine the need for session validation during actions like sending transactions or signing messages. If the callback returns true
, it triggers session validation. If it returns false
, the related action is cancelled. This mechanism ensures that only validated sessions can proceed with sensitive operations.
Listen for session validations
Events like transaction sends may silently prompt session validation. Use the onValidationRequired
hook to catch such instances.
Manage Automatic session validation
Automatic session validation occurs during actions that require validation. Manage this process using the onValidationRequired hook.
By returning true
or false
from the onValidationRequired
hook, you either continue or cancel the action, respectively.
Close Session
A session can be closed using the id
of the session. Any session can be closed from any device with an active session.
Was this page helpful?