Azure Graph API:在多个租户上授权应用程序

时间:2014-12-05 18:49:04

标签: azure oauth exchange-server exchangewebservices office365

我正在尝试创建一个应用程序来浏览Exchange上的联系人目录 我已经设置了所有内容,我可以通过我的应用程序请求授权 我可以提供模态视图,输入登录信息,检索令牌,但当我尝试使用我创建的相同帐户授权应用程序时,我收到此消息:

The client <my app id> and resource <my app URI> identify the same application.

如果我尝试授权其他帐户,我会收到此消息:

User account <an email> from external identity provider <a url> is not
supported for application <my app id>  

如果我尝试登录Graph Explorer ConsoleOffice 365 OAuth Sandbox,他们可以使用第二个地址,但不能使用第一个地址。

我真的很困惑。我觉得我搞砸了一些配置选项,但我真的不明白哪一个。

1 个答案:

答案 0 :(得分:3)

关于#1,在针对您的租户网址进行身份验证时,请不要传递App ID resource querystring参数的var signInUrl = String.Format( "https://login.windows.net/{0}/oauth2/authorize?response_mode=form_post&response_type=code+id_token&scope=openid+profile&client_id={1}&resource={2}&redirect_uri={3}&state={4}&nonce={5}", Uri.EscapeDataString(tenantId), Uri.EscapeDataString(clientId), Uri.EscapeDataString("https://graph.windows.net"), Uri.EscapeDataString(redirectUri), Uri.EscapeDataString(state), string.Format("{0}{1}", DateTime.UtcNow.Ticks, Guid.NewGuid().Stringify()) ); 。我遇到了同样的问题。

然后我从Github运行了WebApp-MultiTenant-OpenIdConnect-DotNet并记下了它创建的登录URL,并使用了以下内容:

https://graph.windows.net

基本上我使用了App ID而不是https://login.windows.net/common/oauth2/authorize,并且神奇的事情开始起作用了。)。

您可以尝试的另一件事(我还没有尝试过)是针对公共端点App ID进行身份验证,并为resource查询字符串提供{{1}}。

相关问题