【发布时间】:2020-08-30 17:16:04
【问题描述】:
我正在尝试使用 bash curl 命令从 Microsoft 的 Office 365 管理 API 获得响应-
我得到这样的令牌-
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')
然后像这样使用令牌来获取数据-
RESULT=`curl -X GET -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" https://manage.office.com/api/v1.0/$TENANTID/ServiceComms/Services`
我确实使用第一个命令返回了一个令牌,这样可以正常工作并且我的租户/客户端/资源字符串是正确的
但第二个总是给
{
"error":{
"code":"","message":"Authorization has been denied for this request."
}
}
我很确定我可以访问-
我错过了什么?
【问题讨论】:
标签: bash azure api curl office365