Rob Elkin
Rob Elkin

Reputation: 371

Firebase dynamic link with query parameters

I've been looking at replacing all the links in the firebase password reset and welcome emails with something more custom, so it doesn't look terrible for users (so moving from https://some-app-123f.firebaseapp.com to link.some-app.com).

I thought that the best way to do this might be to use the firebase dynamic links, so I set up link.some-app.com in there. All good so far.

I generated a new dynamic link directly in the web interface. This is basically going to be used for everyone, or that is my hope. Let's call that link link.some-app.com/email-link. I have then set this up to point to https://some-app-123f.firebaseapp.com/__/auth/action. Going to the first takes me to the second, all good so far. The links just open the web, not apps, and no interstitial page.

I can replace the "Action URL" in the email template with link.some-app.com/email-link. When I email a password reset, I get a link that looks like this: https://link.some-app.com/email-link?mode=resetPassword&oobCode=[hash]&apiKey=[key]&lang=en

However, when I click on this link in debug mode (adding d=1 to the end), I get a bunch of errors:

The format of parameter (mode) is not whitelisted for this domain.

So I thought that I could solve this by using the whitelisting feature on the link domain in the firebase console, so I've tried a bunch of different options, but these are the two most permissive (to cover both domain bases, though I am pretty sure I need to be whitelisting the target domain i.e. firebase)

^https://some-app-123f.firebaseapp.com.*$
^https://link.some-app.com/email-link.*$

Am I completely missing something? Is this something that just isn't possible because it is redirecting back to firebase?

tl;dr: I'm trying to create an effectively serverless redirect link to the password reset functionality in firebase using a prettier url than firebase gives you out of the box

Upvotes: 2

Views: 1907

Answers (2)

Ashutosh Pathak
Ashutosh Pathak

Reputation: 317

Your URL patterns are incorrect. You haven't escaped . Your pattern should be

^https://some-app-123f\.firebaseapp\.com/.*$

You don't need to add the second URL to whitelist.

Upvotes: 2

Mahboob
Mahboob

Reputation: 1975

If an improper program from the Dynamic Links prevents redirection to the sites that are beyond your control then you need to whitelist the URLs where the Dynamic Links can redirect to. For more information regarding whitelisting URLs please visit the link enter here .

Upvotes: 1

Related Questions