The authentication result will be delivered to the onSuccess callback.See the Auth0.Android configuration for more options for the WebAuthProvider class.
To log the user out, call the WebAuthProvider.logout method. The result of logout will be supplied in the onSuccess callback.This method removes the cookie that the browser set at authentication time, so it forces users to re-enter their credentials the next time they try to authenticate.
If the logout is cancelled, you might want to take the user back to where they were before attempting to log out.
Report incorrect code
Copy
Ask AI
WebAuthProvider.logout(account) .withScheme("demo") .start(this, object: Callback<Void?, AuthenticationException> { override fun onSuccess(payload: Void?) { // The user has been logged out! } override fun onFailure(error: AuthenticationException) { // Something went wrong! } })
Use the AuthenticationAPIClient class to retrieve the user’s profile from Auth0. This requires:
The as received during the login phase
The profile scope to include when WebAuthProvider.login is called
The email scope (if you want to retrieve the user’s email address)
This sample demonstrates a function that retrieves the user’s profile and displays it on screen:
Report incorrect code
Copy
Ask AI
var client = AuthenticationAPIClient(account)// Use the received access token to call `userInfo` and get the profile from Auth0.client.userInfo(accessToken) .start(object : Callback<UserProfile, AuthenticationException> { override fun onFailure(exception: AuthenticationException) { // Something went wrong! } override fun onSuccess(profile: UserProfile) { // We have the user's profile! val email = profile.email val name = profile.name }})
Assistant
Responses are generated using AI and may contain mistakes.