我正在向 auth0 发出请求以使用以下代码获取我的 access_token
var request = require("request");
var options = { method: 'POST',
url: 'https://auth0.com/oauth/token',
headers: { 'content-type': 'application/json' },
body: '{"client_id":"xxx","client_secret":"xxxx","audience":"https://auth0.com/api/v2/","grant_type":"client_credentials"}' };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
我收到以下回复
{"access_token":"xxxxxxxxxxxx","scope":"xxxxxxx","expires_in":86400,"token_type":"Bearer"}
我只想获取 access_token 值,我尝试了 body.access_token 仍然没有用任何人都可以帮助我