let headers = new Headers()
credentials = btoa(userName + ":" + password)
headers.append("Authorization", "Basic " + credentials)
fetch("https://pikaso.me/api/v1/tweet?tweet_id=1468971637223555074", {}, {
'method':'GET'
headers:headers
})
.then(res => res)
.then(data => console.log(data))
Doing this gives a 401 error stating invalid credentials. Using pikaso API refer docs to https://pikaso.me/api
You should pass the headers and method as the second argument to fetch. Right now, you're passing an empty object as the second argument, and the headers and method as the third.
Try this instead:
fetch("https://pikaso.me/api/v1/tweet?tweet_id=1468971637223555074", {
'method':'GET',
headers:headers
})
See the documentation for the fetch function.