Azure-Samples / ms-identity-python-webapp

A Python web application calling Microsoft graph that is secured using the Microsoft identity platform
MIT License
279 stars 133 forks source link

Profile URL doesn't work with new identity package? #107

Closed pamelafox closed 6 months ago

pamelafox commented 1 year ago

I'm just doing some testing with the B2C flow, and noticing that the edit profile URL results in an error:

https://pythonb2c.b2clogin.com/pythonb2c.onmicrosoft.com/B2C_1_reset_password?client_id=64dceede-19bb-4f48-bafe-0b99daca5005

"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

That's from this link formation:

    {% if config.get("B2C_PROFILE_AUTHORITY") %}
      <li><a href='{{config.get("B2C_PROFILE_AUTHORITY")}}?client_id={{config.get("CLIENT_ID")}}'>Edit Profile</a></li>
    {% endif %}

Looking back at how the sample previously did it, using msal, it seems we need to build_msal_appp using that authority URL.

https://learn.microsoft.com/en-us/azure/active-directory-b2c/enable-authentication-python-web-app?tabs=macos#step-5-add-the-web-app-code

I think I could probably hack it using the current identity package by creating a new Auth object, but that doesn't seem intended. Should the identity package be extended to have additional constructor arguments, perhaps? And a profile() method?

jimma72 commented 1 year ago

@pamelafox , thank you for highlighting the issue. Can you please let me know what the correct URI construction should be to access the edit profile flow?

Many thanks

pamelafox commented 1 year ago

I'm not sure offhand about the correct URI construction- I'd have to actually implement the suggested change and see the result. Looks like @rayluo has assigned this issue to himself, so hopefully he can chime in.

jimma72 commented 1 year ago

Thanks Pamela. I'll wait to hear from @rayluo. Thanks for the response


From: Pamela Fox @.> Sent: 06 July 2023 5:51 PM To: Azure-Samples/ms-identity-python-webapp @.> Cc: James Armstrong @.>; Comment @.> Subject: Re: [Azure-Samples/ms-identity-python-webapp] Profile URL doesn't work with new identity package? (Issue #107)

I'm not sure offhand about the correct URI construction- I'd have to actually implement the suggested change and see the result. Looks like @rayluohttps://github.com/rayluo has assigned this issue to himself, so hopefully he can chime in.

— Reply to this email directly, view it on GitHubhttps://github.com/Azure-Samples/ms-identity-python-webapp/issues/107#issuecomment-1623999765, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYIFO2DQABBGAIOLR6IWYDDXO3UJPANCNFSM6AAAAAAYIAA7NI. You are receiving this because you commented.Message ID: @.***>

jimma72 commented 9 months ago

@rayluo have you managed to resolve this issue yet. I am trying to get the edit profile functionality to work but it still errors as above. Your help is appreciated.

Thanks