vmurin / react-native-azure-auth

React Native library implementing Azure AD OAuth2 API
MIT License
85 stars 65 forks source link

[QUESTION] Edit User Profile #132

Closed weyron2014 closed 1 month ago

weyron2014 commented 3 years ago

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!

vmurin commented 3 years ago

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

weyron2014 commented 3 years ago

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 commented 3 years ago

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

vmurin commented 3 years ago

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 commented 1 month ago

The original question seems to address user interaction with Azure portal and not handled by the library. Closing as not related.