Redirection not working with Android App Links when logging out

Hi,

When I try to logout user using WebAuthProvider In Android , I got this error message shown inside a chrome tab
Cannot GET /android/com.{applicationId}/callback
and there no redirection to the app

login is working well using Android App Links with the same callback url

I am using Auth0 Android Latest version 1.19.1

logout method:
WebAuthProvider.logout(auth0Account) .start(context, logoutCallback);

AndroidManifest.xml
<activity android:name="com.auth0.android.provider.RedirectActivity" tools:node="replace"> <intent-filter tools:node="merge" android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="subdomain.eu.auth0.com" android:pathPrefix="/android/{applicationId}" /> </intent-filter> </activity>

Hey @oussamah,

I’m not an Android expert, so unfortunately I can’t answer the question. However, I was wondering if you’ve taken a look at our Android Quickstart? You can download the sample code, and take a look at how logout is implemented there, which seems different to how you’re doing it.

Hopefully this helps.

I’ve already followed this quickstart.

Anyway thank you for your response.

@oussamah,

In this line:

Cannot GET /android/com.{applicationId}/callback

Is that literally the error you’re getting, or did you replace the real application ID with {applicationId} before sharing it here?

@mauricio
Yes, I’m just replacing real application Id.

For login, when I set the “prompt” parameter to “none” I get same error of logout
parameters.put("prompt", "none")

Hi @oussamah,

In Android devices this issue can happen sometimes if the https schema is set to be handled by default using a browser. In some devices it will prompt the user with a “Open application with…” and give you a list of apps that you can open it with. If you happen to select the browser, it will try to open ‘https://subdomain.eu.auth0.com/android/com.{applicationId}/callback’ which will fail since what you want is really to return to the app.

Changing the scheme will prevent the browser from getting the request since it will not be registered to handle your custom scheme. You can give it a try by updating the auth0Scheme Manifest Placeholder on the app/build.gradle and calling .withScheme() on your .login() and logout() methods.

app/build.gradle:

android {
    (...)
    defaultConfig {
        (...)
        manifestPlaceholders = [auth0Domain: "@string/com_auth0_domain", auth0Scheme: "demo"]
    }

login:

WebAuthProvider.login(auth0)
  .withScheme("demo")
  .start(...)

logout:

WebAuthProvider.logout(auth0)
  .withScheme("demo")
  .start(...)

Using something other than https might help since when the request for demo://subdomain.eu.auth0.com/android/com.{applicationId}/callback is issued, the browser will not try to pick it up and it will go directly to your app.

You can find more info on this here:


1 Like