Set bearer token in NodeJS

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Set bearer token in NodeJS



I have a web backend using NodeJS. I want to retrieve data from another server using a link eg https://evoDMSTDev/api/api_event_all.php, and must use a bearer token eg 71D55F6907509 to access it. So, where I have to set the token so I can retrieve that data and display it on my web backend?


https://evoDMSTDev/api/api_event_all.php


71D55F6907509



Thank you for your help :)





Can you please elaborate what you are using? Is it Node.js or PHP? Are you trying to make API/AJAX call from client side or server to server API call?
– Harshal Patil
May 17 at 2:42




1 Answer
1



I create like this in node js, and then just call the obj in your .ejs


obj


.ejs


request({
uri : 'https://evoDMSTDev/api/api_events_all.php',
auth: {
'bearer': '71D55F99570209'
},
rejectUnauthorized: false,//add when working with https sites
requestCert: false,//add when working with https sites
agent: false,//add when working with https sites
}, function(error, response, body) {
if (error) {
console.log(error);
} else {
obj = JSON.parse(body);
}
}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results