简体   繁体   English

Azure Office 365 管理 API

[英]Azure Office 365 Management APIs

I am trying to get a response from Microsofts Office 365 Management API using bash curl commands-我正在尝试使用 bash curl 命令从 Microsofts Office 365 Management API 获得响应-

I get the token like this-我得到这样的令牌-

TOKEN=$(curl -X POST "https://login.microsoftonline.com/$TENANTID/oauth2/token" -d "grant_type=client_credentials&client_id=$CLIENTID&client_secret=$ACCESSCODE&resource=$RESOURCEURL" | jq -r '.access_token')

And then use the token to fetch the data like this-然后使用令牌来获取这样的数据-

RESULT=`curl -X GET -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" https://manage.office.com/api/v1.0/$TENANTID/ServiceComms/Services`

I do get a token back with the first command, so that works fine and my tenant/client/resource strings are correct我确实使用第一个命令返回了一个令牌,因此可以正常工作并且我的租户/客户端/资源字符串是正确的

But the second one always gives但第二个总是给

{
  "error":{
    "code":"","message":"Authorization has been denied for this request."
  }
}

I pretty sure I have access-我很确定我可以访问-

在此处输入图像描述

What am I missing?我错过了什么?

Turns out the resource URL i was using did not match the URL i was requesting data from原来我使用的资源 URL 与我请求的数据不匹配 URL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM