Jigar Pandya
Jigar Pandya

Reputation: 2147

Firebase Dynamic Links always uses first domain url prefix by default for sending authentication email

I have integrated firebase authentication with email in my android app. I have two domain url prefix in dynamic links section. By default, firebase always sends link with first domain url prefix. I tried setting domain url prefix in code by this method -

  actionCodeSettings.setDynamicLinkDomain(getString(R.string.dynamic_link_url))

but it gives error of The provided dynamic link domain is not configured or authorized for the current project Please advice correct way of acheiving this. Thanks in advance.

Upvotes: 6

Views: 1479

Answers (2)

Maks
Maks

Reputation: 7935

I'd doing basically the same as in the question, but just in Flutter setting the dynamicLinkDomain property in the ActionCodeSettings using the EmailLinkProvider eg.

dynamicLinkDomain: 'mysuperapp.page.link',

and it seems to work fine.

I did NOT have to do anything with Firebase CLI updating the hosting history as was suggested in the answer from @fadi-abo-msalam

Given that Flutter would be using the same underlying Android Firebase SDK, perhaps this has been fixed since this question was first asked and it now works for native Android apps as well.

Upvotes: 1

Fadi Abo Msalam
Fadi Abo Msalam

Reputation: 7197

if you added a new URL prefix different from the first one you need to manually update Firebase hosting release history

you can do it by using firebase CLI

  1. make sure firebase cli is installed

  2. firebase login and select your project

  3. run firebase init make sure during project initialization, from the Firebase CLI prompts:to select to set up Hosting and Functions Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys

  4. continue with the default option

once setup is completed it will generate public folder contained index.html 404.html, .firebaserc and firebase.json

then modify the firebase.json and add the following

{
"hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "appAssociation": "AUTO",
    "rewrites": [ { "source": "/links/**", "dynamicLinks": true }, { "source": "/share/**", "dynamicLinks": true } ]
  }
}
enter code here
  1. firebase deploy

please note that links and share are our 2 prefix you can change name to any you want and also note this prefix can be used by different subdomains as well

Upvotes: 1

Related Questions