Fix Auth0 Android Login Failures During Google Play Review
Last Updated:
Overview
Resolve Android login failures during Google Play review by switching the Auth0 redirect from an HTTPS scheme (App Link) to a custom URL scheme. App Links require a network verification step that short-lived review sandboxes do not have time to complete, causing Android to open the callback in Chrome instead of the application. When utilizing the Auth0.Android SDK, logins succeed on real devices but fail specifically during Google Play review. In this scenario, Android sends the OAuth callback to the browser instead of the application. The browser returns a 404 error for the callback path since it is not a real web page; the login never completes, and Auth0 issues no token.
Applies To
- Auth0
- Auth0.Android SDK
- Android App Links (HTTPS scheme redirects) using
android:autoVerify="true" - Android 12 (API level 31) and later
- Google Play review process (short-lived sandbox devices)
Cause
Android treats an HTTPS-scheme redirect as an App Link, which requires the operating system to verify the assetlinks.json file of the application over the network before routing the link to the application. On real devices, this verification completes well before the login occurs. Google Play review devices are short-lived sandboxes with limited networking, causing the installation and login to happen before verification finishes. On Android 12 and later, an unverified App Link opens in Chrome instead of the application. Since the callback path is not a real web page, Chrome returns a 404 error, drops the authorization code, and Auth0 issues no token. This is standard Android App Links behavior and not an issue with Auth0.Android SDK.
Solution
What resolves Auth0 Android login failures during Google Play review?
Switch the redirect from the HTTPS scheme to a custom scheme (for example, <yourscheme>). A custom scheme is not an App Link, eliminating the assetlinks.json verification step. Android resolves the custom scheme purely from the installed manifest of the application, opening the application successfully on both review and real devices. Proof Key for Code Exchange (PKCE) continues to protect the redirect regardless of the scheme, maintaining the security of the authentication flow.
Update the scheme placeholder in the application manifest, remove the auto-verify flag, modify the login and logout code, and add the custom-scheme URL to the Auth0 Dashboard. All three locations must use the exact same scheme value to ensure the callback URL matches and the login succeeds.
- In the application manifest or
build.gradlefile, change the scheme placeholder to the custom scheme.manifestPlaceholders = [ auth0Domain: "<login.yourcompany.com>", auth0Scheme: "<yourscheme>" ] - Remove
android:autoVerify="true"from the Auth0 callback activity intent filter. NOTE: If the intent filter already references the scheme placeholder forandroid:scheme, no further manifest edit is needed. - In the login and logout code, add
.withScheme("<yourscheme>")to both builders.WebAuthProvider.login(account) .withScheme("<yourscheme>") // ... .start(context, callback) WebAuthProvider.logout(account) .withScheme("<yourscheme>") // ... .start(context, callback) - Navigate to the Auth0 Dashboard.
- Select Applications, and then choose Applications.
- Select the application, and navigate to the Settings tab.
- Add the custom-scheme URL to the Allowed Callback URLs field (for example,
<yourscheme>://<login.yourcompany.com>/android/<com.yourcompany.app>/callback). - Add the custom-scheme URL to the Allowed Logout URLs field (for example,
<yourscheme>://<login.yourcompany.com>/android/<com.yourcompany.app>/callback). - Save the changes.
To verify the fix, reinstall the application on a fresh device or emulator. The login opens the application immediately with no network warm-up, and the callback path no longer appears as a 404 error in the logs.