auth0 / auth0-flutter

Auth0 SDK for Flutter
https://pub.dev/documentation/auth0_flutter/latest/
Apache License 2.0
57 stars 37 forks source link

"Not found" upon logging in on Android 33 #321

Closed MilesAdamson closed 9 months ago

MilesAdamson commented 9 months ago

Checklist

Description

Upon logging in with webAuthentication and login, after entering my username and password, I see a screen which just says "not found". The future does not complete from login and I do not get the login tokens. Pressing X from this screen counts as cancelling the login.

image

Reproduction

  1. Clone sample project and follow readme https://github.com/auth0-samples/auth0-flutter-samples/blob/main/sample/README.md
  2. Update auth0 secrets and change android applicationId
  3. Build and run app
  4. Login successfully

Additional context

The same thing happens with my actual app, but I can reproduce it in the sample project as well.

auth0_flutter version

1.2.0

Flutter version

3.10.6

Platform

Android

Platform version(s)

Android 33

MilesAdamson commented 9 months ago

I tried it also on Android 29 and the same thing is happening. Maybe it has something do do with my existing auth0 setup?

Previously, login was happening with a POST to /oauth/token and everything else was handled on our end. Now, I am trying to change this to allowing single sign on

MilesAdamson commented 9 months ago

This appears to be an Android issue, it's working fine on my iOS device with the same code. Both the same project and my own are working fine and I get tokens back

jdmanifest commented 9 months ago

I'm having the same problem, will report back if I find a solution.

jdmanifest commented 9 months ago

So if you're defining https as a custom scheme, that seems to have been my problem.

Widcket commented 9 months ago

Closing, as the issue seems to have been resolved. Please feel free to ping if you'd prefer to reopen.

MilesAdamson commented 9 months ago

@Widcket could you direct me to any solutions/docs on how people fixed this in the past please? The sample project has this issue out of the box for me so I'm not sure how this is resolved.

For scheme I have just what the example project has:

manifestPlaceholders['auth0Scheme'] = "@string/com_auth0_scheme"

and

<string name="com_auth0_scheme">https</string>

Custom scheme was not set in my .env, I tested deleting the scheme from webAuthentication just to check and have the same "not found" behavior

Widcket commented 9 months ago

@poovamraj could you please take this one?

MilesAdamson commented 9 months ago

Please re-open this issue, as it seems to be common and unresolved. I tried changing the scheme to "demo" and adding another callback url in Auth0, but that didn't work.

https://community.auth0.com/t/i-am-using-default-schema-for-flutter-webauthentication-login-but-after-login-i-am-not-coming-back-in-app/118873

https://stackoverflow.com/questions/76031825/auth0-integration-in-flutter-android-not-returning-to-app-after-login-logout

https://community.auth0.com/t/flutter-webauth-redirects-to-not-found-page/89557

https://community.auth0.com/t/flutter-gives-not-found-instead-of-redirecting-to-app/98929

https://github.com/auth0/auth0-flutter/issues/291

jdmanifest commented 9 months ago

Please re-open this issue, as it seems to be common and unresolved. I tried changing the scheme to "demo" and adding another callback url in Auth0, but that didn't work. However it did behave differently - I just get a blank webpage and cannot log in.

https://community.auth0.com/t/i-am-using-default-schema-for-flutter-webauthentication-login-but-after-login-i-am-not-coming-back-in-app/118873

https://stackoverflow.com/questions/76031825/auth0-integration-in-flutter-android-not-returning-to-app-after-login-logout

https://community.auth0.com/t/flutter-webauth-redirects-to-not-found-page/89557

https://community.auth0.com/t/flutter-gives-not-found-instead-of-redirecting-to-app/98929

291

Can you post you're callback links from ur auth0 application off the dashboard? Sounds like you may have them in their wrong.

MilesAdamson commented 9 months ago

I am confident they are set properly, or else I would see the callback mismatch screen upon trying to log in. I saw this screen at one point during setup when I just tried to run the plugin without adding the URL's yet.

If I use https as my scheme, this happens:

If I use "demo" as my scheme, this happens:

image

ajyong commented 9 months ago

I'm not sure the root cause for custom schemes but for https, the pub.dev documentation is lacking an important step: supporting Android App Links.

This guidance is provided here and here and is missing from the pub.dev equivalent. Although it's covered in EXAMPLES.md, I thought it be better if it was also surfaced in the main README. I've submitted #324 to do that.