Actual api should be like below:
https://.../api/v1/users/getprofile?access_token={{access_token}}
Below is how I am trying to call the API using request
const request = require('request');
request.get("https://.../api/v1/users/getProfile?accessToken=",{accessToken: req.query.accessToken})
However, it failed. How can I print out whats the url being called ? And how can I fix the error ?
You can use something like this.
const request = require("request")
request.get({url: "http://.../api/v1/users/getprofile", qs: {"accessToken": "xxxxx"}}, function(err, response, body) {
console.log(err, body);
})
Try this:
const request = require('request');
try {
var strURI = encodeURI("https://.../api/v1/users/getProfile?accessToken=");
request.get(strURI, {accessToken: req.query.accessToken});
} catch(e) {
console.log("Exception: " + e.message);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.