Closed francescoberardi closed 1 year ago
Your callback URL scheme is actually invalid: https://github.com/ThexXTURBOXx/flutter_web_auth_2#troubleshooting-callbackurlscheme The callback URL scheme should only be the scheme you are using
Thanks for the answer, but I didn't understand 😅 For mobile platform I pass the schema following the mentioned rules and it works, but for Web I followed the instructions: https://github.com/ThexXTURBOXx/flutter_web_auth_2#web and this is my code:
final callbackUrl = Uri(
host: Uri.base.host,
scheme: Uri.base.scheme,
port: Uri.base.port,
path: 'auth.html',
).toString()
final result = await FlutterWebAuth2.authenticate(
url: authUrl,
callbackUrlScheme: callbackUrl,
);
How can it work on the web if it doesn't accept a url? I'm probably missing something
If you take a close look at the web implementation (https://github.com/ThexXTURBOXx/flutter_web_auth_2/blob/master/flutter_web_auth_2/lib/src/flutter_web_auth_2_web.dart), you will see that the callbackUrlScheme
parameter is not used anywhere. So it doesn't matter what you put in as long as it is a valid RFC 3986 scheme as described in my link above.
Your code is obviously passing a URL as callbackUrlScheme
which is NOT a valid scheme
Ohh, I didn't notice that it wasn't used. Thank you very much 🙂
Describe the bug
After updating the library from version 2.0.0 to the latest version I'm not able to authenticate when running app on WEB. I always receive the error: Error: Invalid argument (callbackUrlScheme): must be a valid URL scheme:
To Reproduce
Pass any web url as callbackUrlScheme e.g. http://localhost:8080/auth.html or https://yourdomain/auth.html
Device (please complete the following information!)
flutter_web_auth_2
version: >= 2.0.1Additional context
After some investigation I think that the issue is due to the _assertCallbackScheme method:
I think that the check should behave for web like for windows/linux:
I can contribute and open a PR with the fix. Let me know what do you think