Giter Club home page Giter Club logo

Comments (3)

bgavrilMS avatar bgavrilMS commented on June 1, 2024

Interesting. It looks like MSAL's HttpClient isn't compatible with WASM. Luckely you can provide your own

https://learn.microsoft.com/en-us/entra/msal/dotnet/advanced/httpclient#example-implementation

from microsoft-authentication-library-for-dotnet.

pmaytak avatar pmaytak commented on June 1, 2024

Blazor WASM is a web app framework, no? So you should use ConfidentialClientApplication.

See Public client and confidential client applications for differences between two types.

There's a Blazor WASM sample here that uses MSAL JavaScript and a Blazor Server sample here which actually uses Microsoft.Identity.Web - an simplified abstraction over MSAL.NET (recommended).

from microsoft-authentication-library-for-dotnet.

Awiprogs-AW avatar Awiprogs-AW commented on June 1, 2024

I didn't ask for explanation what Blazor WASM is and have already implemented the "right" MSAL solution using MSAL.js and MS Graph. But there are problems with it and I wanted to have full control over authentication like I have with PublicClientApplication in e.g. WPF or Web.API. I don't want to have some additional stuff done with Cookies, Session Storage etc. behind me. PublicClientApplication gives me the possibility for the same process with same sign-in dialog and all the things it offers but finally returning a response with which I can do what I want. You can also see that WPF is in first group and Web.API (confidential app) in the second one and in both cases I could test a PoC with PublicClientApplication so I don't know what you were going to point me out. I don't need to go into security details here.
I'd no like to explain all the details from the current implementation as it will take too much time, but logging-out and leaving "trash" somewhere makes my application working incorrectly for personal accounts especially after logging out. Generally using RemoteAuthenticatorView and AddAccountClaimsPrincipalFactory is what I'd like to avoid and that's the reason why I tried to implement something what just returns me a log-in result with which I can do whatever I want within the AuthenticationStateProvider.
The provided solution https://github.com/Azure-Samples/ms-identity-blazor-wasm/tree/main/WebApp-graph-user/Call-MSGraph seems to be a tricky one for me and will not solve the problems I have.
My solution would be almost fine unless
await graphClient.Me.RevokeSignInSessions.PostAsRevokeSignInSessionsPostResponseAsync();
worked for all account types including personal accounts. Unfortunately, clean log out works only for work accounts.
https://learn.microsoft.com/en-us/graph/api/user-revokesigninsessions?view=graph-rest-1.0&tabs=http

from microsoft-authentication-library-for-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.