Android error: a0.authentication_canceled: The user closed the browser app and the authentication was canceled.
Opened this issue · 1 comments
Checklist
- The issue can be reproduced in the auth0_flutter sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
I clone this repo to play with the example app and follow the steps to use my domain and client id. I renamed .env.example
to .env
and filled with my values. Same for strings.xml.example
to strings.xml
and replace with my values. I edited the example app L54 and L83, with these code:
// L54
final result = await auth0.webAuthentication().login(
redirectUrl: '<my_package_id>://login-callback',
useEphemeralSession: true,
);
// L83
await auth0.webAuthentication().logout(
returnTo: '<my_package_id>://logout-callback');
and run the app in both iOS and Android. It works on iOS, after tapping on Web Auth Login
button, I can see the web page, enter my email and password and tap Log In
, then I can see the idToken
printed in the Flutter app. But when I run the same code on Android (both simulator or actual device) I always see the web page being dismissed automatically without user interaction and this is the error :
a0.authentication_canceled: The user closed the browser app and the authentication was canceled.
How can I fix that code? What am I missing to configure in Android to make it work?
Reproduction
- clone repo
- edit
env
file with your values - edit
strings.xml
with your values - edit
webAuthLogin()
method L54 with:
final result = await auth0.webAuthentication().login(
redirectUrl: '<my_package_id>://login-callback',
useEphemeralSession: true,
);
- edit
webAuthLogout()
method L83 with:
await auth0.webAuthentication().logout(
returnTo: '<my_package_id>://logout-callback');
- run the app on iOS, tap on 'Web Auth Login', you will be able to log in and the
idToken
will be printed in the Flutter app. - run the app on Android, tap on 'Web Auth Login',, you will see the web being launched and dismissed automatically without user interaction. And error is
a0.authentication_canceled: The user closed the browser app and the authentication was canceled.
Additional context
No response
auth0_flutter version
auth0_flutter
Flutter version
3.19.3
Platform
Android, iOS
Platform version(s)
No response
This is a video of what I am seeing: