Azure active directory Active Directory B2C重定向URI与Angular应用程序

Azure active directory Active Directory B2C重定向URI与Angular应用程序,azure-active-directory,angular7,azure-ad-b2c,msal,Azure Active Directory,Angular7,Azure Ad B2c,Msal,我们正在将该服务与Angular应用程序一起使用,我们构建该应用程序是为了使用我们的广告B2C登录和身份验证 我们遇到的问题是Angular应用程序有许多路由,其中几个路由是参数化的,可以有n个可能性 我们将MSAL服务设置为: B2CAccessTokenKey = 'b2c.access.token'; tenantConfig = { tenant: 'deepdivebioportal.onmicrosoft.com', clientID: 'xxxxxx-xxxx-x

我们正在将该服务与Angular应用程序一起使用,我们构建该应用程序是为了使用我们的广告B2C登录和身份验证

我们遇到的问题是Angular应用程序有许多路由,其中几个路由是参数化的,可以有n个可能性

我们将MSAL服务设置为:

B2CAccessTokenKey = 'b2c.access.token';

tenantConfig = {
    tenant: 'deepdivebioportal.onmicrosoft.com',
    clientID: 'xxxxxx-xxxx-xxxx-xxxx-xxxxx',
    signInPolicy: 'B2C_1_signin',
    signUpPolicy: 'B2C_1_signup',
    redirectUri: 'https://xxx.yyyy.net',
    b2cScopes: ['https://zzzzz.onmicrosoft.com/api/Hello.Read']
};

// Configure the authority for Azure AD B2C
authority = 'https://login.microsoftonline.com/tfp/' + this.tenantConfig.tenant + '/' + this.tenantConfig.signInPolicy;

/*
 * B2C SignIn SignUp Policy Configuration
 */
clientApplication = new Msal.UserAgentApplication(
    this.tenantConfig.clientID, this.authority,
    function (errorDesc: any, token: any, error: any, tokenType: any) {
    }
);
我们正在静默地使用Aquire令牌在刷新时刷新令牌:

this.clientApplication.acquireTokenSilent(this.tenantConfig.b2cScopes);
我们已将所有更高级别的路由添加到Azure中的应用程序设置重定向URI中,如果用户恰好位于列表中未明确列出的路由上,我们将收到一个错误,并且无法刷新令牌

我发现许多其他问题也提出了类似的问题,解决方案似乎是在重定向uri中使用通配符。然而,这似乎不再得到支持

是否有解决方案来处理n个重定向路由

我得到的具体错误是:

main.b13cb77fd1caaf3b9027.js:1 ERROR Error: Uncaught (in promise): AADB2C90006: The redirect URI 'https://xxxxxx.yyyyyyy.zzz/ttttttt/show/23' provided in the request is not registered for the client id 'd86e217f-7a14-4cfc-b6ae-4f46a2eff943'.

为什么不能使用单个重定向url来获取访问令牌?Acquiretokensilent用于以静默方式刷新访问令牌,如果将回复URL设置为类似主页的内容,则不会影响用户体验,因为它实际上不会重定向用户。它只会得到一个新的访问令牌。根据文档:它发送一个隐藏的iframe,因此重定向url实际上不会用于重定向用户。为什么不能使用单个重定向url来获取访问令牌?Acquiretokensilent用于以静默方式刷新访问令牌,如果将回复URL设置为类似主页的内容,则不会影响用户体验,因为它实际上不会重定向用户。它只会得到一个新的访问令牌。根据文档:它发送一个隐藏的iframe,因此重定向url实际上不会用于重定向用户。