I'm working on an app which uses a Oauth authentication, I'm having some trouble with the url parameters. I've tried several different ways but my API is returning that the username and password aren't being passed to the API
我正在开发一个应用程序,它使用Oauth认证,url参数有点问题。我尝试了几种不同的方法,但是我的API返回的是用户名和密码不被传递给API。
Here's my code (removed the private details):
这是我的代码(去掉了隐私细节):
$http({
url: 'http://test.com/oauth/v2/token',
method: "GET",
params:{
username: user.username,
password: user.password,
client_id: 'xxxxxxx',
client_secret: 'xxxxxxx',
grant_type: 'password'
}
}).success(function(data, status) {
console.log(data);
}).error(function(data, status) {
console.log(data);
console.log(status);
});
My API returns Object {error: "invalid_request", error_description: "Missing parameters. "username" and "password" required"}
(error 400).
我的API返回对象{error:“invalid_request”,error_description:“缺失的参数。"username"和"password" required"}(错误400)。
Cheers in advance!
提前欢呼!
1 个解决方案
#1
3
Code looks good although parts are missing. Check what is being sent via your browser developer tools. Usually F12. See if the url is being called with the query parms.
代码看起来不错,但是缺少了一些部分。检查通过浏览器开发工具发送的内容。通常F12。查看是否使用查询解析器调用url。
#1
3
Code looks good although parts are missing. Check what is being sent via your browser developer tools. Usually F12. See if the url is being called with the query parms.
代码看起来不错,但是缺少了一些部分。检查通过浏览器开发工具发送的内容。通常F12。查看是否使用查询解析器调用url。