IsAuthenticated is always false for an acquired token in WPF
See original GitHub issueDiscussed in https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/discussions/3759
<div type='discussions-op-text'>Originally posted by aoun-muhammad October 25, 2022 I am trying to implement Authentication for Blazor Hybrid (WPF) as per this documentation https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/security/?view=aspnetcore-6.0&pivots=wpf
I have used the MSAL like this,
string[] scopes = new string[] { "user.read"};
AuthenticationResult authResult = await app.AcquireTokenInteractive(scopes)
.WithAccount(firstAccount)
.WithParentActivityOrWindow(new WindowInteropHelper(this).Handle) // optional, used to center the browser on the window
.WithPrompt(Prompt.SelectAccount)
.ExecuteAsync();
There is a ClaimsPrincipal property in authResult, which has ClaimsIdentity. But the problem is that it always has AuthenticationType as null and IsAuthenticated as false.
I would like to know why IsAuthenticated is always false, and what I can do so that I get it as true when I acquire a token.</div>
As per @bgavrilMS this is a bug, hence reporting it.
Issue Analytics
- State:
- Created a year ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
IsAuthenticated is always false for an acquired token in WPF
I would like to know why IsAuthenticated is always false, and what I can do so that I get it as true when...
Read more >User.Identity.IsAuthenticated always false in .net core when ...
I have an asp.net core application using json web tokens for authentication, this worked fine when my user Id was a string, ...
Read more >Context.User.Identity.IsAuthenticated is always false in jwt ...
I am using signalr with jwt token. `services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.
Read more >Desktop app that calls web APIs: Acquire a token interactively
Learn how to build a desktop app that calls web APIs to acquire a token for the app interactively.
Read more >How to get an access token with Authorization Code Grant
To make an eSignature REST API request, you must include: The acquired access token in the request's Authorization header. The base URI for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ack, let’s reconsider this.
Yes I have done something similar but I used “AuthenticationTypes.Federation” as authenticationType because this is what Blazor return. So for my WPF implementation I am using the same.