Android应用程序,错误时尝试发送电子邮件
我下载的例子:上发送按钮 https://dev.office.com/Getting-Started/office365Apis?platform=option-android#register-app 点击抛出这个错误:Android应用程序,错误时尝试发送电子邮件
RetrofitError: 404 Not Found
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Bearer access token is empty.",
"innerError": {
"request-id": "951626d4-0168-4b58-a78a-1fdd3bd322f2",
"date": "2016-04-29T18:34:05"
}
}
}
你缺少一个访问令牌。来自https://msdn.microsoft.com/en-us/office/office365/api/discovery-service-rest-operations:
Discovery Service operations
Initial sign in
This brings the client to a web page where the user enters account information. It returns the endpoints needed to continue with Discovery Service. This is used the first time a user tries your application. It tells your application: what cloud the user belongs to where the app can send the user to log in where to go to get a token
你可以继续在官方网站上阅读它。
OP询问的示例是Microsoft Graph。 Microsoft Graph应用程序不使用发现服务,而是直接从AAD获取令牌。 – GarethJ
它看起来像也许你没有注册你的应用程序在下载样本之前。示例中的readme指令应引导您注册和配置应用程序,此时登录应该成功,您将获得不记名令牌。
我假设你不喜欢那个错误,并期望别的东西。错误的原因是“承载访问令牌为空”。另请看看http://stackoverflow.com/help/how-to-ask。 – totoro