I have recently implemented this feature by following the steps outlined below.
Please ensure that the following permissions are enabled in your B2C application.
1- User-PasswordProfile.ReadWrite.All
2- UserAuthenticationMethod.ReadWrite.All
Generate a token by making a request to the endpoint provided below in order to interact with the Graph API.
Call the endpoint provided below to update the user data.
The request body should include the new password in the "Password" field.
For additional guidance, please refer to the resources provided below.
https://learn.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http
https://learn.microsoft.com/en-us/graph/api/resources/passwordprofile?view=graph-rest-1.0