I’m trying to follow the Tweets lookup quick start guide for my app. I got it to run successfully on Postman, but in JavaScript I keep getting 401 or 403 errors in my https website.
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer ...");
myHeaders.append("Cookie", "guest_id=v1%3A165287884644622974");
var requestOptions = {
method: 'GET',
mode: 'no-cors',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.twitter.com/2/tweets/1521843451108765697", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Unfortunately you cannot run this from client-side JavaScript, because the API does not support CORS.