How to let user edit profile?
See original GitHub issueCore Library
Core Library Version
2.14.0
Wrapper Library
Wrapper Library Version
2.0.0-beta.4
Description
I’m trying to let user edit their profile in my application, but the only function that takes the user to edit profile page is the “loginRedirect” or “loginPopup”. The problem is that, when I use that functions and the user complete the flow, the msal library gets two accounts on “getAllAccounts()” and none of them has the updated info.
MSAL Configuration
{
auth: {
clientId: ‘',
authority: '’,
navigateToLoginRequestUrl: false,
redirectUri: ${window.location.origin}
,
},
cache: {
cacheLocation: ‘localStorage’,
}
}
Relevant Code Snippets
const client = new PublicClientApplication({
auth: {
clientId: ‘',
authority: '’,
navigateToLoginRequestUrl: false,
redirectUri: ${window.location.origin}
,
},
cache: {
cacheLocation: ‘localStorage’,
}
})
client.loginRedirect()
Identity Provider
Azure B2C Custom Policy
Source
External (Customer)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top GitHub Comments
@luismiguelprs @tiny-dancer Right now the way the B2C service is designed (separating different operations into different user flows) causes MSAL to see idTokens from different flows as completely different “users” (tokens are also not shared across flows). If and until that design changes there are 2 approaches you can take to work around the multiple account issue:
getAllAccounts
and choose the account for the flow you wish to use. You can find the name of the flow the account belongs to in eitheridTokenClaims.tfp
oridTokenClaims.acr
on each account object.@luismiguelprs I think I understand now.
Given that MSAL has to support multiple authentication services, there aren’t any B2C specific APIs (such as
ClientApplication.editProfileRedirect()
). Using the login and acquireToken APIs for these use cases is the right approach. As to the duplicate accounts after a user changes their profile information, we’ll take a look and see if we can reproduce the behavior and see if there’s changes to be made to fix this. Thanks!