1

I've written a Google Apps Script function that shortens the URL using Firebase's Dynamic Links -

function fbURLShort() {
  var data = {
    "dynamicLinkInfo": {
      "domainUriPrefix": "https://example.page.link",
      "link": "https://example.com/lenghtlyURL?with=hooks&more=additions"
    },
    "suffix": {
      "option": "SHORT"
    }
  };
  var url = "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=myAPIkey"
  var options = {
    'method': 'POST',
    "contentType": "application/json",
    'payload': JSON.stringify(data),
    "muteHttpExceptions":true
  };
  var response = UrlFetchApp.fetch(url, options);
  Logger.log(response)
  var json = response.getContentText();
  var data = JSON.parse(json);
  var obj = data["shortLink"];
  Logger.log(obj)
}

This works perfectly well when using the example.page.link domainUriPrefix; however, there is also a way to Connect a custom domain and I've been able to successfully do that too (this domain would show up under Firebase's Hosting section).

However, when I replace example.page.link with customdomain.com, it throws the following error -

  "error": {
    "code": 400,
    "message": "Your project does not own Dynamic Links domain: https://customdomain.com [https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]",
    "status": "INVALID_ARGUMENT"
  }

Now, what I want to do is use said custom domain as a base link to shorten URLs instead of .page.link (via Dynamic Links). How do I go about doing that?

Sourabh Choraria
  • 2,255
  • 25
  • 64

2 Answers2

0

There is currently no way to use a full custom domain for Firebase Dynamic Links. Custom subdomains under page.link are all that is available.

That said, we've heard this request before. So if you're really interested in it, please file a feature request.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
0

as of November 2019 it is possible to do this, with up to 10 domains, custom or *.page.link domains.... as long as they all share the same suffix :(

hlecuanda
  • 123
  • 1
  • 6