我正在使用ADAL4j尝试对我们的onprem sharepoint实例(它本身使用AAD进行身份验证作为企业应用程序)进行身份验证,以便在通过标准流程进入时对用户进行身份验证。
我已经设置了我的消费者AAD应用程序,要求获得“访问{on sharepoint企业应用程序}”的权限。我正在向一个看起来像这样的网址发出请求:
https://login.microsoftonline.com/{tenant}/oauth2/authorize?
response_type=code&scope=user_impersonation&
response_mode=form_post&
redirect_uri={uri that is registered in my app}&
client_id={my app id}&
resource={onprem sharepoint enterprise app id}&
state={GUID}&nonce={GUID}
我收到的回复是401 UNAUTHORIZED:
{
"error": "invalid_client",
"error_description": "Invalid audience Uri '{onprem sharepoint enterprise app id}'."
}
关于这里可能出现什么问题的任何想法?我的搜索效果并不是很有成效,从逻辑上讲它似乎应该有效。在企业应用程序方面是否有一些设置允许某些客户端访问该资源?
谢谢您的帮助!
你应该用resource={onprem sharepoint enterprise app id}
(安全资源)替换App ID URI of onprem sharepoint enterprise app
。有关详细信息,您可以参考Oauth 2.0 grant flow。