需要格式化令牌请求的帮助。我搜索了一遍,看了很多文档。提琴手的回应是关于“grant_type”的大喊,但它包括在内。oauth 2.0到微软认证服务器
POST http://localhost:4400/ripple/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=https%3A//login.microsoftonline.com/[removed]/oauth2/token HTTP/1.1
Host: localhost:4400
Connection: keep-alive
Content-Length: 104
Authorization: Basic YWZyaWVkOnRlc3Q=
Origin: http://localhost:4400
Content-Type: text/plain;charset=UTF-8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
X-Ripple-User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.2; en-us; Nexus S Build/GRH78C) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Accept: */*
Referer: http://localhost:4400/login.html
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
grant_type='password'&username='afried'&password='test'&client_id='[removed]'
我还试图在发送它们没有“(grant_type =密码,例如),以及创建一个对象(我试图字符串化的话):
var data = { 'grant_type': 'password',
'username': userID,
'password': password,
'client_id': clientId
};
提琴手哪些文章作为
[object Object]
Authorization头是用户名:密码,我的印象是,用密码批,您可以直接从令牌端点请求而不先击中身份验证的端点,因为你正在发送用户名/密码。
我有.withCredentials = true。内容安全策略也可以。
任何帮助将不胜感激。我知道这很简单,我只是看不到它,我想我只是没有经验,没有什么是跳出来对我的。
2016-06-15
Aaron
+0
它看起来像我必须设置一个内容类型标题。我已经过了grant_type的问题,但现在想要一个“资源”......仍然在努力,但我认为答案只是“添加一个Content-Type标题[我使用了application/x-www-form-urlencoded和它似乎在工作“] –