Skip to content

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

Closed

Description

@nstrelow

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-team-archive/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.

Activity

  1. added
    bug
    on Jul 14, 2021
  2. himeshp commented on Jul 14, 2021

    @himeshp

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

  3. nstrelow commented on Jul 14, 2021

    @nstrelow
    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=...

  4. himeshp commented on Jul 14, 2021

    @himeshp

    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.

  5. nstrelow commented on Jul 14, 2021

    @nstrelow
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions