Active Directory B2C Redirect URI With Angular App

柔情痞子 提交于 2021-02-10 14:37:03

问题


We are using the MSAL service with an Angular App we built to use our AD B2C Login and Authentication.

The problem we are running into is that the Angular App has many routes, several of them are parameterized and can have n number of possibilities.

We set up the MSAL Service in our Angular like:

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) {
    }
);

We are using Aquire Token Silently to refresh the token on refresh:

this.clientApplication.acquireTokenSilent(this.tenantConfig.b2cScopes);

We have added all our higher level routes to the App Setup Redirect URI's in Azure and if the user just happens to be on a route that is not explicitly in the list we get an error and can't refresh the token.

I have found many other questions asking similar questions and the solution seems to be to use wildcards in the redirect uri. However this no longer seems to be supported.

Is there a solution for this to handle n number of redirect routes?

The specific error I am getting:

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'.

来源:https://stackoverflow.com/questions/56195622/active-directory-b2c-redirect-uri-with-angular-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!