Check if signed in
What counts as “signed in” is your app’s business logic, not ours. Wrap the check in a helper you own so the rule lives in one place. The minimal version is “an authenticated user exists, or any wallet is connected”:- Authenticated user —
dynamicClient.useris set once the user authenticates. - Wallet connected —
isAnyWalletAccountConnected()(orgetWalletAccounts()) covers verified and unverified wallets. - Onboarding complete —
isUserOnboardingComplete()rolls up KYC fields, MFA, and recovery codes. See Check if onboarding is complete. - Device registered —
isDeviceRegistrationRequired(user). See Check if the user needs to complete device registration. - MFA satisfied —
isUserMissingMfaAuth()andisPendingRecoveryCodesAcknowledgment()flag MFA the user still owes. - Required embedded wallet —
getChainsMissingWaasWalletAccounts()from@dynamic-labs-sdk/client/waasreturns the chains where the user still needs an embedded wallet.
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).
- JavaScript
- React
Get the current authenticated user
- JavaScript
- React
Get the user JWT
- JavaScript
- React
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.
- JavaScript
- React
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.
Check if the user needs to complete device registration
After authentication, you can check whether the current device needs to be registered and complete registration on redirect. For the full flow, see Device Registration.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.