Authentication
Native Android ==> Shared module
Authenticating requests with the Validic API requires a Validic Mobile User to be provisioned and with a Validic Mobile User Token. Further documentation for creating Validic Mobile Users is available in Provisioning and Managing Users.
You will need to provision the user from your server or your mobile app.
Provisioning a User
It is required to use valid Validic user credentials. The validicUserID, organizationID, and accessToken properties will be sent to the Inform server for validation at the start of any user session. Sessions started with invalid or unknown user credentials (i.e. any credentials not provisioned by the Validic API) will be ended automatically and you will not be able to receive data records from the Inform SDK.
It is recommended to provision the user on your server, the mobile app could then authenticate to the server and retrieve the Validic credentials.
Start Session
Once a Validic Mobile User has been provisioned, the Validic Mobile AuthManager can be used to start a session and validate a Validic Mobile User and the user's token
viewModelScope.launch {
val user:User = User("Your Organization ID", "A Validic ID", "A Validic User Mobile Access Token")
SessionV2.getInstance(context).authManager.login(user)
}
End Session
An end user's session be ended by calling AuthManager.logout(). This will end the client's persisted User and cancel all pending work in the Validic Mobile SDKs. See Record Events for details on how to listen for User Session events.
viewModelScope.launch {
SessionV2.getInstance(context).authManager.logout()
}
Keep in mind the Important Considerations when ending the user session.
Updated 3 days ago