J.Do
J.Do

Reputation: 201

Firebase Dynamic Links losing app parameters in Capacitor Browser redirect chain on Heroku

I have a weird issue with Firebase Dynamic Links in my Capacitor app. When using deep links to authenticate users via SAML, it looks to be losing specific URL parameters but only in my staging environment on Heroku.

The flow

  1. User enters domain name and clicks "Login with SSO"
  2. App calls my GraphQL endpoint to get a redirectUrl
  3. App opens this URL using Browser.open({ url: redirectUrl })
  4. User authenticates with their SSO provider
  5. SSO provider redirects back to my SAML callback endpoint on my API
  6. API adds token to the URL and redirects to the return URL (via res.redirect) (which is a Firebase Dynamic Link)
  7. Firebase Dynamic Link should open my app with all parameters

What works

What doesn't work

Code

I'm using Capacitor Browser to open the link:

// This works locally but not in staging
Browser.open({ url: redirectUrl });

The full URL from server logs (works correctly):

https://myapp.page.link/?link=https%3A%2F%2Flink.myapp.com%2F%3Fauth_token%3DeyJ0eXAi...&apn=com.mycompany.app&ibi=com.mycompany.app&ofl=get.myapp.com

What I see in Capacitor Browser after redirect (truncated):

https://myapp.page.link/?link=https%3A%2F%2Flink.myapp.com%2F%3Fauth_token%3DeyJ0eXAi...

Notice how the parameters apn, ibi, and ofl are missing from the URL after the redirect chain.

What I've tried

The primary difference between my environments is that the staging API runs on Heroku while my local API runs directly on my development machine.

What could be causing Heroku to drop these specific parameters during the redirect chain? I just don't quite understand why the entire flow works perfectly fine locally but not when the API is deployed on Heroku, it could be a red herring.

Upvotes: 0

Views: 26

Answers (0)

Related Questions