你好Microsoft / Azure / Skype专家,
我的任务是从我的macOS应用程序(本机)访问Skype For Business Online帐户中的状态数据。我不幸被卡住了,当我访问自动发现请求并且永远不会获得应用程序资源的链接时,我总是会收到403错误
我一直在关注这个文档https://docs.microsoft.com/en-us/skype-sdk/ucwa/authenticationusingazuread
步骤1我们使用Office 365帐户凭据在Azure管理门户中注册了应用程序。
步骤2按照文档中的规定发布GET以启动登录和授权检查。
这返回200 OK。
步骤3我们获得了文档中描述的自动发现URL。这就是我得到的 - 我使用RED标记的域名。 https://login.microsoftonline.com/common/oauth2/authorize?response_type=token&client_id=c#####-4d41-485e-871f-0a22aa79e52b&redirect_uri=http://localhost
第4步根据文档,他们要求我这样做
使用隐式授权流请求访问令牌所以我按照描述发出GET
? response_type = id_token&client_id = ###### - 4d41-485e-871f-0a22aa79e52b&redirect_uri = https://login.microsoftonline.com/oauth2/authorize&state = 8f0f4eff-360f-4c50-acf0-99cf8174a58b&resource = http://localhost
现在这显示登录页面,我登录然后它会抛出错误
https://webdirin1.online.lync.com
我研究过,无法修复此错误。因此经过大量研究并查看此Microsoft文档LINK(AADSTS90014%3a+The+required+field+%27nonce%27+is+missing.
)后,显然还有另一种获取持有者令牌的方法。
第4步 - 第二次尝试
然后,我通过发送Skype for Business的SCOPE参数请求个人用户同意。然后我发出GET请求
这将返回一个访问代码,我将在下一步中使用该代码来获取TOKEN
第5步 - 让持票人忘记
向以下URL发出POST https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=#######-4d41-485e-871f-0a22aa79e52b&response_type=code&redirect_uri=http://localhost&response_mode=query&scope=https://api.skypeforbusiness.com/User.ReadWrite&state=12345在POST正文中使用以下数据
“grant_type”:“authorization_code”,“client_id”:“###### - 4d41-485e-871f-0a22aa79e52b”,“scope”:“https://login.microsoftonline.com/common/oauth2/v2.0/token”,“code”:“OAQABAAIAAACEfexX ....... ..“,”redirect_uri“:”https://api.skypeforbusiness.com/User.ReadWrite“
这将在以下响应JSON中返回承载令牌
https://localhost
第6步
好极了!在laaast获得持票人令牌!现在回到主要文档{
"access_token" = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1........w4b-- gnWG_iOGtQ";
"expires_in" = 3599;
"ext_expires_in" = 3599;
scope = "https://api.skypeforbusiness.com/User.ReadWrite";
"token_type" = Bearer;
}
我们这样做 - '使用持票人令牌重新发送自动发现请求'我们执行GET请求
https://docs.microsoft.com/en-us/skype-sdk/ucwa/authenticationusingazuread
现在这个,根据文档应该返回这个JSON
https://webdirin1.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user
但是我获得了403:允许拒绝错误
{
"_links":{
"self":
{"href":"https://webdirX.online.lync.com/Autodiscover/AutodiscoverService.svc/root/user"},
"applications":
{"href":"https://webpoolXY.infra.lync.com/ucwa/oauth/v1/applications"}
}
}
因此,我从来没有得到应用程序网址,我已经检查了清单,注册,我不知道,为什么我得到这个错误。
任何输入将不胜感激。
对于步骤4,您需要在URL中指定<div class="content-container"><fieldset>
<h2>403 - Forbidden: Access is denied.</h2>
<h3>You do not have permission to view this directory or page
using the credentials that you supplied.</h3>
</fieldset></div>
。通常,这应该是一个只使用一次的安全随机值。它可以包含任何值。
此外,您只需要一个id令牌。设置nonce=somestring
。