【发布时间】:2017-10-24 13:46:16
【问题描述】:
我可以使用带有以下参数的邮递员成功创建访问令牌, 回调地址:https://www.getpostman.com/oauth2/callback 代币名称: 授权网址: 访问令牌网址: 客户编号: 客户秘密: 授予类型:客户端凭据。
但我无法通过 Curl 或 node.js 获取访问令牌,如下所示,
var request = require("request");
var options = { method: 'POST',
url: '',
headers: { 'content-type': 'application/json' },
body: '{"client_id":"","client_secret":"","audience":","grant_type":"client_credentials"}' };
request(options, function (error, response, body) {
if (error) console.log(error);
//console.log(response);
console.log(body);
});
我将邮递员详细信息映射到 node.js 脚本的位置,
Auth URL: url
Access Token URL: audience
Client Id: client_id
Client Secret: client_secret
Grant Type: grant_type
但我没有任何回应。我可以知道我哪里出错了吗?还是我们有任何其他机制来获取 OAuth2 访问令牌?
我只是按照https://manage.auth0.com/#/apis/590983763e3ae44a0dd1a219/test的脚本
【问题讨论】:
标签: node.js curl oauth-2.0 access-token postman