问题描述
我想动态了解我的Web API版本以进行S2S集成设置:
遵循以下文档:
在调用globaldiscovery网址以获取版本时获取 401 /未经授权
示例通话: ## query获取发现服务请求的令牌
curl --location --request POST 'https://login.microsoftonline.com/<tenant-id-from-azureAD>/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'resource=https://disco.crm.dynamics.com/' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=<client-id-from-azure-AD>' \
--data-urlencode 'client_secret=<client-secret>'
##全局服务请求:
curl --location --request GET 'https://globaldisco.crm.dynamics.com/api/discovery/v1.0/Instances?$select=Version' \
--header 'Accept: application/json; odata.Metadata=minimal' \
--header 'Content-Type: application/json;odata.Metadata=full' \
--header 'OData-MaxVersion: 4.0' \
--header 'OData-Version: 4.0' \
--header 'Authorization: Bearer <access-token-got-from-prev-step>
##以上请求失败,并显示(401未经授权):
{
"error":{
"code":"","message":"Authorization has been denied for this request."
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)