react-native-azure-auth icon indicating copy to clipboard operation
react-native-azure-auth copied to clipboard

[QUESTION] Edit User Profile

Open weyron2014 opened this issue 3 years ago • 4 comments

Hi guys,

I am trying to add an Edit Profile user flow to my application. I've edited theauthorityUrl with .authorize method and it works, but it requires a new sign up/sign in even if the user is authorized. Is there are any ways we can pass the userId to .authorize method to check if the user is signed in or any other ways to skip the unnecessary Sign In/Sign Up for the Authorized users while using other user_flows except SignUp/SignIn?

Thanks a lot!

weyron2014 avatar Oct 13 '21 18:10 weyron2014

Hi,

please check the sample application - you will find the usage of acquireTokenSilent method. It is possible to get a new access token without user interaction.

regards, Vlad

vmurin avatar Oct 14 '21 19:10 vmurin

Hi again, seems like there was a misunderstanding. I will try to explain it better this time.

I know that it's possible to get a new access token silently using the acquireTokenSilent method, however, I don't need to. I am trying to implement an Edit User profile with Azure B2C using Profile editing flow.

In order for me to open that Edit page, I will need to use .autorize method and set the authority link to: 'https://myTenant.b2clogin.com/myTenant.onmicrosoft.com/B2C_1_edit_profile/oauth2/v2.0/'. Where 'B2C_1_edit_profile' is the name of my Profile editing flow.

Azure meanwhile will ask you to Authorize before you can make any changes, or will allow you to edit the user profile if the user is authorized already. So, my question is: if the user is already authorized in my app, how can I open that Edit Page and let Azure know that the User is already Authorized?

Sorry that I didn't explain it properly the first time and let me know if it's clear this time,

Thanks, Oleg

weyron2014 avatar Oct 14 '21 22:10 weyron2014

@vmurin Could you open the issue again? Still unresolved. Thanks a lot!

weyron2014 avatar Oct 19 '21 02:10 weyron2014

Sorry, I don't have any experience with B2C. But I assume the general approach should be the same - you have some API to edit the profile and need access token with according scopes to be able access the API. You can get the token using the library and then use Profile API for editing. It it works in anther way - you have to investigate it by yourself. It could be that only MSAL library supports special B2C features.

vmurin avatar Oct 19 '21 19:10 vmurin