Now, I want to set up a custom policy for sign-in and sign-up (separate flows) within Power Pages. Everything seems to be working fine, and the custom policy flow is functioning correctly (it can store the data properly). However, after completing the sign-up or sign-in flow, the custom policy redirects to the homepage. Unfortunately, the user data from the sign-up process is not being stored in the Power Pages Contact Table (but have stored inside the Azure AD B2C). I’m calling the custom policy using the MSAL browser JS because Power Pages only allows setting up one flow configuration (either sign-up combined with sign-in or any single flow). Below is my code for calling the custom policy:

 $("#SignUp").click(function(){
    acquireToken();
  });

  const msalConfig_signUp = {
    auth: {
      clientId: 'clientId',
      authority: 'https://yourtenant.com/b2c_1a_signup',
      knownAuthorities: ["yourtenant.b2clogin.com"],
      redirectUri: 'https://yourtenant.com/signin-aad-b2c_1',
    },
  };

  const msalInstance = new msal.PublicClientApplication(msalConfig_signUp);

  async function resetRedirect(){

    await msalInstance.handleRedirectPromise();

  }

  resetRedirect();

  async function acquireToken(){
    // Call the function to initiate token acquisition

     try {
       // Parameters for token request
       const request = {
           scopes: ['openid' , 'email'],
         };
 
         await msalInstance.acquireTokenRedirect(request);


     }  
     catch (error) {
       console.error('Error during token acquisition:', error);
     }
   }

I have only performed these specific actions without configuring anything else. Am I missing any crucial steps? If so, how can I resolve this issue?

New contributor

yik ccy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.