我有2个来自不同组织(租户)的SharePoint网站:
已在Tenan 1'abc.sharepoint.com'的azure门户上注册并授予了应用程序的必要权限,以便可以由Tenant 2用户访问:'xyz.sharepoint.com'
我想通过租户2'xyz.sharepoint.com'的用户进行身份验证,您可以查询sharepoint的数据,例如:
当我发出请求时:
https://graph.microsoft.com/v1.0/sites/root或https://graph.microsoft.com/v1.0/sites/xyz.sharepoint.com
由于用户来自该租户,因此它查询了“ xyz.sharepoint.com”站点,因此令人满意地返回了信息。
...但是当我咨询指定租户'abc.sharepoint.com'
https://graph.microsoft.com/v1.0/sites/abc.sharepoint.com
返回以下错误:
{
"error": {
"code": "invalidRequest",
"message": "Invalid hostname for this tenancy",
"innerError": {
"request-id": "c0a8fa51-245b-4d1e-bf0b-5f32b6c0eb26",
"date": "2019-08-17T16:27:57"
}
}
}
其中一个已与另一租户的用户进行了身份验证。如何查看申请已注册的信息?
答案 0 :(得分:0)
我们不能使用从一个租户那里获得的访问令牌来访问另一租户。
如果要这样做,您需要:
https://login.microsoftonline.com/common/oauth2/authorize?client_id={client id of the app registered in Azure AD of Tenant 2}&response_type=code&redirect_uri={reply url of the app registered in Azure AD of Tenant 2}&nonce=1234&resource=https://graph.microsoft.com&prompt=admin_consent