List of Organization - working from postman, same Auth Token gives 403 forbidden error

List of Organization is working and showing me list of organziation in Postman, when i use the same token in code i get an error 403 forbidden. Here is the code:

async GetOrganizations4Login(login: string) {
const postData =
  {"query": "query {         viewer {            name                organizations(last: 10) {                  nodes {                    name                }              }            }       }", "variables":{} };

const options =
host : ‘’,
method: ‘POST’,
port: 443,
path: ‘/graphql’,
headers: {
“Content-Type”: “application/json”,
“Authorization”: “Bearer 51987338eac0ada924844c76c4”,
“Accept” : “application/vnd.github.machine-man-preview+json”,
“Content-Length”: Buffer.byteLength(postData),
“cache-control”: “no-cache”

let post_req = await https.request (options, (res: any) => {
console.log (res);
post_req.write (postData);
post_req.end ();

} catch (ex) {
console.log (ex)

I tried putting the word “Bearer” and without anything in front of Token, but everytime i get 403, same is working from Postman.

What am i missing?

Appriciate your help.

Found the issue! When i used ‘request’ library i saw the whole error string, which told me it needs a user-agent in header.  

Once I added a user-agent header got everything working fine.