0

In my Flutter (Android/iOS) app I am using Firebase Dynamic Links for Patreon.com OAuth2 apis.

My dynamic link is https://myappname.page.link/patreon

The deep link is https://myappname.net/patreon

Patreon is using the https://myappname.page.link/patreon as a redirect_url , and is supposed to append some parameters to it, so it looks like https://myappname.net/patreon?code=xxx

However, all I receive inside my app is the naked url https://myappname.net/patreon

There are no parameters attached to it.

So how can I tell Firebase to preserve the query parameters Patreon is attaching to the redirect_url?

As an alternate question, is there a better way to listen for incoming response inside of a Flutter app, without the use of Dynamic Links?

1 Answers1

0

You loose all parameters by using that.

If you're relying on Patreon to send back that parameter I'd suggest to generate a small proxy where you can redirect your calls to the dynamic link by generating it on the fly.

So:

NOTE: Pay attention to the &p1=aaa&p2=bbb parameters added

  • Return a 302 and redirect to your newly generated link

Based on how you configure it from the console this link can redirect to the store or your app, in your app you can listen for the link as follows:

      FirebaseDynamicLinks.instance.onLink(
        onSuccess: (dynamicLink) async => handleDeepLink(dynamicLink?.link),
      );

In handleDeepLink you can parse your custom query parameters.

NOTE: The URL parameter you pass via the dynamic link HAS TO BE ENCODED! Which means your link will look more like this:

https://example.page.link/?link=https%3A%2F%2Fwww.example.com%2Fsomeresource%26apn%3Dcom.example.android%26amv%3D3%26ibi%3Dcom.example.ios%26isi%3D1234567%26ius%3Dexampleapp%26p1%3Daaa%26p2%3Dbbb
Gabriel Costache
  • 859
  • 1
  • 6
  • 17
  • Thank you for your reply, but I cannot use it because I Have no host/microservice/proxy. All I have is my mobile app. I did some more research and it looks Firebase dynamic links do not allow parameters added, UNLESS they are initially declared using firebase APIs – Puffing Devil Sep 01 '22 at 04:39