ADAL 身份验证错误多租户
ADAL Authentication Error Multi-Tenant
我从 GIT 中获取了多租户的示例代码。
https://github.com/OfficeDev/O365-WebApp-MultiTenant
在 https://manage.windowsazure.com/ 中,我将多租户启用为是。但是当我尝试用不同的组织登录时,我收到如下错误。
来自身份提供商“https://sts.windows.net/xxxxxxxxxxxxxxxxxxxxxxxxxxx/”的用户帐户 'vtest@someconsuting.onmicrosoft.com' 在租户 'My Test App ' 中不存在,无法访问该租户中的应用程序 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'。需要先在租户中将账号添加为外部用户。注销并使用不同的 Azure Active Directory 用户帐户重新登录。
我该如何解决这个问题?
请确保您的权限 url 为“https://login.windows.net/common”。
如果你的权限url是“https://login.windows.net/{tenant_id}”,你会得到如下错误:
要解决此问题,请在 Startup.Auth.cs 中将权限 url 配置为“https://login.windows.net/common”。
var authority = string.Format("{0}/{1}", ServiceConstants.AzureADEndPoint, "common");
var options = new OpenIdConnectAuthenticationOptions {
ClientId = OAuthSettings.ClientId,
Authority = authority,
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters {
ValidateIssuer = false
}
};
我终于找到了解决问题的方法。从此URLhttps://github.com/dream-365/OfficeDev-Samples/blob/master/samples/Office365DevQuickStart/AspNetMvc-MultiTenant/
我将以下文件复制到我的项目中
TokenCacheDBContext.cs
SqlDBTokenCache.cs
ServiceConstants.cs
App_Start/Startup.auth.cs
我 运行 项目并收到一个 Office365AssertedFailedException 错误。为此,我又创建了一个 class 文件,例如
Office365AssertedFailedException.cs
我重新编译代码,成功了。现在我可以使用多租户登录了。
我遇到了同样的问题。刚刚更换
string authorityUri = "https://login.microsoftonline.net/common/";
和
string authorityUri = "https://login.windows.net/common";
我从 GIT 中获取了多租户的示例代码。 https://github.com/OfficeDev/O365-WebApp-MultiTenant
在 https://manage.windowsazure.com/ 中,我将多租户启用为是。但是当我尝试用不同的组织登录时,我收到如下错误。
来自身份提供商“https://sts.windows.net/xxxxxxxxxxxxxxxxxxxxxxxxxxx/”的用户帐户 'vtest@someconsuting.onmicrosoft.com' 在租户 'My Test App ' 中不存在,无法访问该租户中的应用程序 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'。需要先在租户中将账号添加为外部用户。注销并使用不同的 Azure Active Directory 用户帐户重新登录。
我该如何解决这个问题?
请确保您的权限 url 为“https://login.windows.net/common”。
如果你的权限url是“https://login.windows.net/{tenant_id}”,你会得到如下错误:
要解决此问题,请在 Startup.Auth.cs 中将权限 url 配置为“https://login.windows.net/common”。
var authority = string.Format("{0}/{1}", ServiceConstants.AzureADEndPoint, "common");
var options = new OpenIdConnectAuthenticationOptions {
ClientId = OAuthSettings.ClientId,
Authority = authority,
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters {
ValidateIssuer = false
}
};
我终于找到了解决问题的方法。从此URLhttps://github.com/dream-365/OfficeDev-Samples/blob/master/samples/Office365DevQuickStart/AspNetMvc-MultiTenant/
我将以下文件复制到我的项目中
TokenCacheDBContext.cs
SqlDBTokenCache.cs
ServiceConstants.cs
App_Start/Startup.auth.cs
我 运行 项目并收到一个 Office365AssertedFailedException 错误。为此,我又创建了一个 class 文件,例如
Office365AssertedFailedException.cs
我重新编译代码,成功了。现在我可以使用多租户登录了。
我遇到了同样的问题。刚刚更换
string authorityUri = "https://login.microsoftonline.net/common/";
和
string authorityUri = "https://login.windows.net/common";