Create/Invite user in azure ad b2c and then allow user to reset password on first login

Deepika Mahant 36 Reputation points
2022-11-29T08:32:03.32+00:00

I have created user in azure ad b2c successfully, Now I want users to activate their account. I am using graph client invite api to create/invite users
This is my request object:
var invitation = new Invitation
{
InvitedUserEmailAddress = user.Email,
SendInvitationMessage = true,
InviteRedirectUrl = "https://myredirect.page",
InvitedUserDisplayName = user.FullName,
};
var result = await graphClient.Invitations
.Request()
.AddAsync(invitation);
After this user is invited and got an email in their inbox, but the activation link in email is using OTP to authenticate the account. Is there any way that I can redirect user to reset their password and us that password for future.

Developer technologies | ASP.NET | ASP.NET Core
Microsoft Security | Microsoft Entra | Microsoft Entra External ID
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Akshay-MSFT 18,011 Reputation points Microsoft Employee Moderator
    2022-11-30T13:08:43.297+00:00

    Hello

    We could force the user to reset password on first login via Custom Policies. This sample console app (.Net core) demonstrates how to send sign-up email invitation. The web application sends an email to the end user with a link to sign-up policy. The link to the sign-up policy contains the email address, which is encapsulated inside a JWT token (id_token_hint). When a user clicks on that link, Azure AD B2C validates the JWT token signature, reads the information from the token, extracts the email address and ask the user to set the password, display name, surname and given name.

    Kindly follow email invite custom policy as per: https://github.com/azure-ad-b2c/samples/blob/master/policies/invite/policy/SignUpInvitation.xml

    • Where in 3rd orchestration step LocalAccountSignUpWithReadOnlyEmail technical profile is called:

    265763-image.png

    • This technical profile force user to set the password without editing the email address:

    265689-image.png

    Please do let me know if you have any further queries on this in the comments section.

    Thanks,
    Akshay Kaushik

    Please "Accept the answer", "Upvote" and rate your experience if the suggestion works as per your business need. This will help us and others in the community as well.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.