【发布时间】:2016-08-31 05:27:53
【问题描述】:
下面的代码不起作用。授予类型是“client_credentials”。它返回状态为 -1 的空响应。 API没问题。这两个请求在邮递员上都可以正常工作
function authentication(user) {
return Restangular
.all('token')
.post('grant_type=client_credentials&client_id=' + APPLICATION.clientId + '&client_secret=' + 'XYZ',
undefined, { 'Content-Type': 'application/x-www-form-urlencoded' });
}
下面的代码与“密码”授权类型完美配合。
function authentication(user) {
return Restangular
.all('token')
.post('grant_type=password&username=' + user.username + '&password=' + user.password + '&client_id=' + APPLICATION.clientId,
undefined, { 'Content-Type': 'application/x-www-form-urlencoded' });
}
怎么了?
【问题讨论】:
标签: javascript angularjs oauth oauth-2.0 restangular