Problem using firebase dynamic links via REST API

519 views
Skip to first unread message

Aditya Thakur

unread,
May 6, 2020, 8:19:32 AM5/6/20
to Firebase Google Group
I'm currently new to firebase and was trying to make a simple web app that gives a shortened URL using firebase dynamic links for a user provided input.
(I also considered using bitly URL shorten extension but I don't have a billing account configured to use it)

My function for the same on client-side (for testing only) looks like this:

async function fetcher(keyAPI,tempURL) {

            let parameters = {
                method : "POST",
                headers: {
                    'Content-Type''application/json'
                },
                body : JSON.stringify({
                    "longDynamicLink"tempURL,
                     "suffix": {
                         "option": "SHORT"
                         }
                    })
                }; 
                
               await fetch(reqURL,parameters)
                .then(res => console.log(res))
                .catch(err => console.log(err));

            }



When I run the function in the console, I recieve the following response:


Response {
  redirected: true,
  status: 400,
  ok: false,
  statusText: "Bad Request",
  headers: Headers,
  body: ReadableStream,
  bodyUsed: false
}

Need help regarding the same, I also checked Dynamic Links API was enabled for the project in the console and I can make short links in firebase console.

#AskFirebase #Firebase #dynamiclinks #firebasedynamiclinks

Reply all
Reply to author
Forward
0 new messages