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

Android/iOS deeplink not working due to URI fragment #3

Closed
nstrelow opened this issue Jul 14, 2021 · 4 comments
Closed

Android/iOS deeplink not working due to URI fragment #3

nstrelow opened this issue Jul 14, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@nstrelow
Copy link

nstrelow commented Jul 14, 2021

I am super excited to see a dedicated flutter package for Supabase! Kudos for that 👏

Has anyone gotten deeplinks to work on Android and iOS @phamhieu ?
I report this, expecting it not to work. Should it somehow work for you, I will be glad to scrutinize a working example until I get mine to work.

I just can't deeplinks to work on Android (and iOS probably as well). I came across this bug in April, when I tried to enable the deeplink logins with Supabase.

There is a bug inside Flutter, where it ignores the URI fragment, which Supabase uses by design choice, e.g. my-url.com?queryParam=unrelatedToSupabase#accessToken=...

Everything after the URI fragment (#, also called anchor) gets cut from the deeplink URL.

Here is the related issue: flutter/flutter#80666
and PR that hopefully fixes it: flutter/engine#26185

On web everything should be working and I am using it for my project daily 💯

Steps to reproduce:

  1. Configure Deeplinks
  2. Set deeplink (might be required) in Android App Info
  3. Correctly configure redirect URLs
  4. Login with Gitlab or similar
  5. App reopens via deeplink
  6. Doesn't have accessToken

Debug log:

I/flutter ( 5229): onReceivedAuthDeeplink uri: https://studyu-designer.codemagic.app/#/%23access_token=...
I/flutter ( 5229): ***** onErrorAuthenticating: No access_token detected.
@nstrelow nstrelow added the bug Something isn't working label Jul 14, 2021
@himeshp
Copy link

himeshp commented Jul 14, 2021

the example with GitHub login works fine, did you get a chance to check that code?

@nstrelow
Copy link
Author

@himeshp That is awesome. I got the example working as well.

But something is wrong. I am using an http/https deeplink address to get it working. Does your deeplink trigger a different type of Flutter function, which does not remove the hashtag/URI fragment?

Working debug:

onReceivedAuthDeeplink uri: io.supabase.flutterdemo://login-callback#access_token=...

@himeshp
Copy link

himeshp commented Jul 14, 2021

hey, I have not got a chance to check the code yet. I just checked the sample code for reference purposes.

I am waiting for the support of native pop-up support for apps, to start further using supabase as backend.

maybe @phamhieu can further guide here.

@nstrelow
Copy link
Author

Conclusion

The supabase_flutter package is handling deeplinks using the uni_links package. This has its own platform specific code, to handle deeplinks, thus not relying on the Flutter engine code.

Therefore deeplinks work here without a Problem.

I thank @phamhieu for developing this awesome plugin. This will help me finally achieve deeplinks on Android and iOS and not having to wait for the flutter framework fix to be deployed.

Furthermore the Singleton approach to initializing Supabase is much better than my global variable I am currently using.
So thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants