Android Delegated User APIs
External authentication APIs for third-party identity providers. Use when your app manages its own user authentication and you want to integrate with Vipaso without using Vipaso's identity system. Access these APIs through Vipaso.user.delegated
.
Establish Authentication
Use delegated authentication when your app already has user accounts and you want to maintain your existing identity management while using Vipaso's features.
// Connect your existing authentication system with Vipaso. Call this method after your user logs in through your own authentication system
Vipaso.user.delegated.establishAuthentication(
// The unique identifier for the user in your system
userIdentifier = "user-123",
// A callback that receives a JWK (provided by Vipaso SDK) and returns a string from your backend
connect = { jwk ->
// 1. Send the JWK to your backend endpoint
// 2. Your backend should process the JWK and return an encrypted token
// 3. Return that token here
// Example implementation:
return yourBackendService.processJwk(jwk)
}
)
// Once this call returns successfully, User can now access Vipaso features
// If there is an error you can catch it and handle it
Authentication State
Observe whether a user is currently authenticated.
Vipaso.user.delegated.isAuthenticated()
.collect { authenticated ->
if (authenticated) {
// Show main app content
} else {
// should authenticate by calling establishAuthentication
}
}
Logout
Remove the stored session token and reset the auth state.
Vipaso.user.delegated.logout()