Check if signed in
Log the user out
Call thelogout function, and it will clear all the session data, including the Dynamic user and any connected wallets (non verified wallets).
Get the current authenticated user
Get the user JWT
Update the current authenticated user
CallupdateUser to update the current Dynamic user.
You can pass many user fields to the function, and it will update the user with the new values.
If any of the fields require OTP verification (like email or phone number), the function will return an OTPVerification object,
that you can use to check what kind of OTP verification is required (email or phone number), send the OTP to the user, and verify the OTP.
Check if a user has missing fields
You can toggle user data collected and also to be required or not in the Dynamic dashboard. We don’t control that in the JavaScript SDK, but you can check if a user has missing fields by calling theuser.missingFields property.
With that, you can display the appropriate UI to the user to complete the onboarding process, and call the updateUser function to update the user with the missing fields.
Check if onboarding is complete
You can check if a user has completed all onboarding requirements (including KYC fields, MFA authentication, and recovery codes acknowledgment) by calling theisUserOnboardingComplete function.
This function provides a comprehensive check of all requirements and returns true only when the user has completed everything.
Refreshing the current authenticated user (Dynamic user)
You can refresh the current authenticated user (Dynamic user) by calling therefreshUser function.
This function will refresh the user object in the SDK with the latest data from the server.