简体   繁体   中英

Azure B2C Show Signup Page First in Unified Signup/Signin Flow

I have been using the b2c starter packs and MSDN docs about ContentDefinitions, as well as the various other aspects of the Azure B2C offering.

As anybody who has ever tried implementing custom policies has realised, the documentation isn't always so thorough or explicit, and is often grammatically incorrect or missing details.

With this in mind, I wonder:

  • Is it possible to trigger the 'sign up' screen before the 'sign in' screen in a unified signup/signin flow?
  • Also, is it possible to add a 'sign in' screen link to the 'sign up' screen?
    I know that it is possible to add a 'sign up' screen link to a ContentDefinition by adding <Item Key="setting.showSignupLink">false</Item> to its MetaData, but this link seems to come out of the box anyway when using the api.signuporsignin ContentDefinition.
    So far, I have tried adding a <Item Key="setting.showSigninLink">false</Item> to my ContentDefinition's MetaData block, but to no avail (I didn't find this in the MSDN docs anywhere, just had a thought to try it).

To clarify, in a signup/signin flow, I would like to show the 'sign up' screen as soon as I launch the policy, then optionally navigate to the 'sign in' page.

Any suggestions would be greatly appreciated.

For anyone else finding themselves here... the Azure team now have provided a sample of how to do this in a custom policy. You provide a query string parameter to navigate directly to the sign up page.

https://github.com/azure-ad-b2c/samples/tree/master/policies/sign-up-deep-link

It's not possible. You could ask for email using B2C, and then send the user to sign in or sign up based on if it exists, in a single B2C policy.

But to get to the UX you describe, you need to split the journey into two, sign up and separate sign in.

You can do that by converting Step 1 & Step 2 into a single step of type:ClaimsExchange and referencing the sign in or signup technical profile respectively.

Then you need to enable users to go between the two policies. To do this, embed a link in each policy using custom html: myapp.com/signin or myapp.com/signup. The app should then send a properly formed auth request to the respective B2C policy Id. https://docs.microsoft.com/en-us/azure/active-directory-b2c/customize-ui-with-html?pivots=b2c-custom-policy

The schema reference is here https://docs.microsoft.com/en-us/azure/active-directory-b2c/self-asserted-technical-profile

You can learn more here https://azure-ad-b2c.github.io/azureadb2ccommunity.io/docs/custom-policy-concepts/

The solution I came up with is the following:
There is no native way (ie - an xml policy configuration parameter you can set) to add a restart-flow/login button to the signup page.

If your main aim is to just navigate from '/signup' baack to '/signin', I would recommend adding the following html to your template, which you can then style to your liking:

(Note the call to `history.back()` on the anchor tag)
<body>
    <div class="container unified_container">
      <div class="row">
        <div class="col-lg-6">
          <div class="panel panel-default">
            <div class="panel-body">
              <div id="api"></div>
              <div id="signinContainer">
                <p>
                  Already Registered?
                  <a
                    id="signinLink"
                    type="submit"
                    aria-disabled="false"
                    aria-label="To Sign in screen"
                    href="javascript:history.back()"
                    >Log in</a
                  >
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>

Alternatively, if you know that you will want to go back a specific number of times (for example, back 3 pages), you can use the following instead of the history.back() we saw above:
history.go(-3);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM