Reset Authentication Flow
🔄 REL-ID SDK API: resetAuthState
resetAuthState
📌 Overview
The resetAuthState()
method is used to reset the current authentication session, typically in cases of:
- Authentication failure
- User-initiated cancellation
- Switching to a different user
This ensures that the SDK returns to a clean state and triggers a fresh getUser
event, allowing the app to restart the login or authentication flow.
📣 Events Triggered
- Immediately after this method is called, the SDK triggers
getUser
This indicates the SDK is ready to accept a new user ID via thesetUser
method.
🔁 Typical Use Case Flow
flowchart TD A[Start Authentication] --> B{User cancels or error occurs} B --> C[App calls resetAuthState] C --> D[SDK emits getUser event] D --> E[App calls setUser to retry or switch user]
✅ Best Practices
- Call
resetAuthState()
before restarting login flow or offering a "Retry" option after failure. - If switching users mid-session, always invoke this method to clean up previous session state.
💻 Code Snippets
React Native
RdnaClient.resetAuthState((syncResponse) => {
console.log("Reset auth state response", syncResponse);
});
Flutter
rdnaClient.resetAuthState();
Cordova
com.uniken.rdnaplugin.RdnaClient.resetAuthState(
function(success) {
console.log("Reset Success", success);
},
function(error) {
console.error("Reset Error", error);
}
);
Native iOS
let error = RdnaClient.resetAuthState()
Native Android
RDNAError error = rdna.resetAuthState();
Updated 2 months ago