Auth0 Android SDK AuthenticationException Occurs When No Browser Is Installed

Overview

An AuthenticationException occurs in the Auth0 Android SDK when an application attempts to authenticate using Universal Login with Proof Key for Code Exchange (PKCE) on a device that lacks an installed or enabled internet browser. To resolve this, install a supported browser on the Android device or handle the exception to prompt the user to install one. Users experience intermittent authentication failures when the SDK returns the following error message:

 

An error occurred when trying to authenticate with the server

 

Applies To

  • Auth0
  • Auth0 Android SDK
  • Universal Login

Cause

The Auth0 Android SDK relies on Android Custom Tabs to launch Universal Login. If a device lacks an enabled internet browser application, the SDK cannot open the login page, which results in an AuthenticationException.

Solution

Why does the Auth0 Android SDK require a browser?

The Auth0 Android SDK uses Custom Tabs for Universal Login to comply with OAuth 2.0 best practices for native applications. Auth0 does not support embedded WebViews for security reasons. Therefore, the device must have a browser installed to complete the authentication flow.

 

Implement error handling to prompt the user to install a browser.

Implement error handling within the application to catch the exception, verify the cause, and prompt the user to install a required browser.

  1. Catch the AuthenticationException that the Auth0 Android SDK returns during the login attempt.
  2. Verify if the absence of a browser on the device causes the exception.
  3. Display a prompt or alert to the user indicating that the application requires an internet browser to log in.
  4. Instruct the user to install or enable a browser application from the device settings or app store.

 

Related References

Recommended content

No recommended content found...