Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: Flutter Web authentication bad URLCallback - doesn't work #114

Closed
2 tasks done
netapy opened this issue Jan 5, 2023 · 8 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working waiting-release

Comments

@netapy
Copy link

netapy commented Jan 5, 2023

👟 Reproduction steps

My app uses flutter (web, Android, iOS) for the front-end and Appwrite for the back end.
I use OAuth to let my users log in.

There is a bug with the flutter_web_auth_2 2.0.3 dependency that Appwrite uses.
To log in to my service, this function is called in my client :

if (kIsWeb) {
  await globals.account.createOAuth2Session(provider: provider, success: "https://banquise.app", failure: "https://banquise.app");
} else {
  await globals.account.createOAuth2Session(provider: provider);
}

But the success and failure callbackUrls give an error because of this check in flutter_web_auth_2 2.0.3 :
https://github.com/ThexXTURBOXx/flutter_web_auth_2/blob/157285f9230cfc1815ed5b2bb6a58b1dabc277d5/flutter_web_auth_2/lib/flutter_web_auth_2.dart#L35-L44
Which verifies if the url scheme corresponds to r'^[a-z][a-z0-9+.-]*$'.

It doesn't, because it's a URL with https://... so not only alphanumerical characters with . and -.

Removing the https:// raises an error in Appwrite saying the callback url is wrong.

👍 Expected behavior

It should not raise an exception for the success and failure url scheme.

👎 Actual Behavior

It raises an exception.

🎲 Appwrite version

Version 1.2.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@netapy netapy added the bug Something isn't working label Jan 5, 2023
@stnguyen90 stnguyen90 transferred this issue from appwrite/appwrite Jan 5, 2023
@stnguyen90
Copy link
Contributor

@lohanidamodar would you be able to help with this?

@stnguyen90
Copy link
Contributor

I'm pretty sure this was working before, but the upgrade of flutter_web_auth_2 to 2.x probably broke it.

@lohanidamodar
Copy link
Member

@netapy I'll look into it.

@hemangjoshi37a
Copy link

I have similar issue #116 Have you found any solutions yet?

@netapy
Copy link
Author

netapy commented Jan 16, 2023

@hemangjoshi37a , for now I just use a forked version of flutter_web_auth_2 I made : https://github.com/netapy/flutter_web_auth_2_oauthlinkfix , just link to this repository instead of the dependency, if you can’t wait for the fix.

@lohanidamodar
Copy link
Member

@netapy @hemangjoshi37a the fix is already merged and should be released soon

@netapy
Copy link
Author

netapy commented Jan 26, 2023

Thanks for handling it.
Is the fix only in the Flutter Client package ?
How long will it take to publish ?
Sorry to push but I can't update my app with my custom fix.

@lohanidamodar
Copy link
Member

@netapy version 8.2.1 should resolve this issue
https://pub.dev/packages/appwrite

@netapy netapy closed this as completed Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting-release
Projects
None yet
Development

No branches or pull requests

4 participants