Blazor WASM Using User Token to Call Graph Client Side

preview_player
Показать описание
In this video we create a Blazor web assembly application with AAD authentication. That uses the user's token to call Azure Graph from the client side.

Coding books I recommend:

My Setup:
Рекомендации по теме
Комментарии
Автор

I know this is an old video, but is this still the accepted method to do this?

If I call "AddMicrosoftGraphClient" in my client WASM app, it fails to log the user in after authentication.

I guess I'm just confused as to why we can't easily delineate the HTTP client for the base Graph functionality that's made from the IDE when you select the checkbox, "Add/Use Graph API" (This automatically creates the "GraphClientExtensions" class).

TerrenceFerguson
Автор

When I run your app with my azure variables I'm unable to get the weatherforcast data (has unauthorized 401 exception). If I remove the [Authorize] attribute in the weatherforecast controller it works fine. Or, if I remove the Graph HTTP code in Startup.cs it works fine too. If you have both server and graph APIs clients set up then it only works with [Authorize] removed at the weatherforecast controller. Any ideas what the cause of this is? Your tutorial is very unique, there isn't much out there related to this scenario. Thanks!

frankneubecker
Автор

Hello, Thank you for this video. It is helpful.. Ihave a question, in the new httpbackendservice you have created - in callapi method when you say usually make it more generic and deserialize it when we call it. Do you have an example of code which has generic way mentioned service class. I want to be able to add this authorization part to dataservice class/classes (which are based on controllers).
Thank you.

manasimahajan
Автор

Really helpful video! Will the code be pretty much the same for a B2C Blazor WASM application?

DodziAgbenorku
Автор

Hi bro, your video was usefull for me. I have a question, what do you think about creating the MSAL and graph authentication throw this sentence with net 5.0

dotnet new blazorwasm -au SingleOrg --api-client-id "{SERVER API APP CLIENT ID}" --app-id-uri "{SERVER API APP ID URI}" --client-id "{CLIENT APP CLIENT ID}" --default-scope "{DEFAULT SCOPE}" --domain "{TENANT DOMAIN}" -ho -o {APP NAME} --tenant-id "{TENANT ID}"

thank you for your help.

aramirezp
Автор

its strange that I can only add permissions like User.Read.All as an application permissions and not as delegated permissions for AAD B2C. so terribly stuck on this one :/

get_ready
visit shbcf.ru