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.
Which SDK this is regarding: Flutter SDK
SDK Version: 1.0.0
Platform Version: Pixel 3a on API 32 emulated on m1 mac.
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.
Sorry to hear you’ve had trouble with the WebAuth process
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:
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.
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 )
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:
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!