I'm investigating how to convert an Angular+.NETv4.7 application to a .NET Core v3 with Blazor and Identity Platform.
I can log in using Identity Platform and my Azure AD, although I have some advanced questions: User stays logged in after deleting from Azure AD
I'm now at the part that I want to show the name and the profile photo of the logged-in user. I'm using this example.
It works, I can get the photo and other data but only when I click on the profile link and trigger the Profile controller. The profile data is saved in ViewData
. But how to get this data in my _LoginPartial.cshtml
? Should I do the call the Graph in my Home controller as well?
Update:
I managed to get it working by creating a View Component
. Is that the proper workflow? I had to create 4 files to get this working: show the photo and the name.
Because Microsoft Identity Platform gave us more trouble than help, we decided to take another route and use Google to authenticate. This made it all much simpler.
I've made a repo with my efforts, feel free to use.
I'll keep enhancing it until I have a sample application that does what I need.
https://bitbucket.org/pmeems/matblazorgooglegsuite/src/develop/