Flutter webAuth redirects to not found page

Hi everybody,

I’ve been having a lot of trouble recently using the WebAuthentication process of the Auth0 Flutter SDK. I got it to work a couple of days ago, but started having issues with the logout process. After a couple of days, the login process stopped working.

The issue is that the redirection that the URI provided by webAuth is returning a ‘Not Found’ website. I’ve seen plenty of topics about how the android SDK has the same issue, and the solution was changing the scheme. I’ve already tried that, and I’ve also tried to use the auth0 sample on github which gave me the same result. Any help would be really apappreciated.

As a side note, I’ve been using vscode, and on the debug console it shows an Authorize URI, which is different from what Chrome on the Android Emulator shows. Copying that ‘Authorize URI’ on safari on macos shows the login web page without any issues.

1 Like

Hi,
Not helping, but I am running into the exact same error. In case you managed to figure it out, your solution will probably be very helpful to me :slight_smile:

Hello @escifo and @jose.runin welcome to the community!

Sorry to hear you’ve had trouble with the WebAuth process :confused:

Going off of the sample app - I’ve just configured it to my auth0 domain and scheme of demo and was able to run it in both an emulator (Pixel 3a on API 32 emulated on intel MB pro) as well as on a physical device without issue (Google Pixel 5a Android 12). Both Login and Logout function as expected. Here’s my strings.xml:

<resources>
    <string name="com_auth0_domain">dev-XXXXX.us.auth0.com</string>
    <string name="com_auth0_scheme">demo</string>
</resources>

Interesting, I see the exact same logging but as I mentioned everything is functioning as expected :thinking:

Do you both experience the same with a similar config, using a simple custom scheme? I’ve only seen this in the past with an https scheme.

Let us know!

Thank you so much for reaching out, @tyf.

I may be missing something, but as soon as I change the scheme to ‘demo’ or ‘app’ or any other string which isn’t https, I get a Callback URL mismatch error.

It would be great if you could sort out what went wrong.

On another note, I got another emulator working on a Windows PC. I got to login and it worked great, but as soon as I got authenticated, I haven’t been able to see any other site which isn’t URL mismatch or not found.

Thanks again for reaching out!

Same as @jose.runin , I was having an error due to callback URL mismatch when changing the scheme. However, it seems I had it working by also specifying the scheme in the login call like this:

auth0.webAuthentication(scheme: "demo").login()

(same for logout)

Not sure this is the proper solution though (I am totally new to flutter, so not sure I understand what I am doing here :smiley: )

Thanks for the hint @tyf, much appreciated!

Thanks for the updates @escifo and @jose.runin!

This might just be due to the fact that you need to update/add the callback url in your application settings in Auth0: demo://YOUR_AUTH0_DOMAIN/android/YOUR_PACKAGE_NAME/callback

All good, I’m still new to it as well! What you’ve done is correct though, see:

https://auth0.com/docs/quickstart/native/flutter/interactive#add-login-to-your-app

Thank you @escifo for the solution! I’m now using that and it’s working alright. I’m guessing the build.gradle isn’t updating the scheme on the auth0 framework, and that’s why we got the Callback URL mismatch error.

Thanks also to @tyf for the hints and the readiness!

1 Like

No problem, happy to help! Good to know it’s functioning as expected for you now :slight_smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.