使用Office 365 oAuth的访问令牌访问用户信息

时间:2016-02-29 09:15:49

标签: oauth-2.0

var clientId = 'xxxxxxx';
var replyUrl = 'http://localhost:55452/HTML/Dashboard.html';
var authServer = 'https://login.windows.net/common/oauth2/authorize?';
var responseType = 'token';
var Office365Login = authServer + "response_type=" + responseType + "&" + "client_id=" + clientId + "&" + "resource=" + resource + "&" + "redirect_uri=" + replyUrl;

我可以接收访问令牌以及重定向网址。现在使用访问令牌如何访问姓名,电子邮件ID等用户信息?我需要向哪个URL发出Ajax请求并获取信息?

1 个答案:

答案 0 :(得分:0)

请通过以下链接: http://social.technet.microsoft.com/wiki/contents/articles/33525.an-introduction-to-microsoft-graph-api.aspx

更新了网址配置:

var clientId = 'xxxxxxx';
var replyUrl = 'http://localhost:55452/HTML/Dashboard.html';
var authServer = 'https://login.windows.net/common/oauth2/authorize?';
var responseType = 'token';
var resource = "https://graph.microsoft.com";
var Office365Login = authServer + "response_type=" + responseType + "&" + "client_id=" + clientId + "&" + "resource=" + resource + "&" + "redirect_uri=" + replyUrl;