Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout from Sample App with error alert in Pixel Identity #94

Open
digitarenet opened this issue Aug 18, 2023 · 5 comments
Open

Logout from Sample App with error alert in Pixel Identity #94

digitarenet opened this issue Aug 18, 2023 · 5 comments
Assignees

Comments

@digitarenet
Copy link

I have made some others tests:

  1. Pixel Identity correctly running
  2. Sample.Service.Api correctly running
  3. Samples.Blazor.App correctly running
  4. Login in Pixel Identity with user A
  5. Reloading Sample.Blazor.App I'm correctly logged in with user A
  6. Now I logout from Sample.Blazor.App
  7. THE ISSUE: in Pixel Identity (I not reload page where I'm already logged) seem that I'm still logged as user A but if I click on any nav menu link I receive an error (MudBlazor Red Alert in the upper right corner) with message:

'<' is an invalid start of a value. Path: $ | LineNumber: 1 | BytePositionInLine: 0.

Inspecting http calls, for example clicking on Account > profile link menu, there is a call to

https://localhost:44382/pauth/api/users/name/**USERNAME**

that response 302 redirect to

https://localhost:44382/pauth/Identity/Account/Login?ReturnUrl=%2Fpauth%2Fapi%2Fusers%2Fname%2F**USERNAME**

and this request response 200 OK with HTML content.

There is something wrong that I have done? Thank you.

@digitarenet
Copy link
Author

AddOn:
At point 7. if I reload Pixel Identity page seem that I'm still logged in.
Instead in Blazor.Sample.App I'm correctly logged out also if I reload home page.

@Nfactor26
Copy link
Owner

Ack. I will have to check this.

@Nfactor26 Nfactor26 self-assigned this Aug 18, 2023
@Nfactor26
Copy link
Owner

Seems issue on client side which is not able to respond to redirect. It will take a while to address this as I still don't have a solution.
Planning to take a look at this when upgrading to dotnet 8. I hope this is not a blocker for you at the moment.

@digitarenet
Copy link
Author

I'have seen that the call in UserServices

var resp = await httpClient.GetFromJsonAsync<UserDetailsViewModel>($"api/users/name/{userName}");

not responding with a json but with html (user is no longer authenticated) because the API has [Authorized] attribute and so deserialization fails.
This also happens with others api.

Instead, it should redirect to login page?

@Nfactor26
Copy link
Owner

yes the client fails to deserialize the response as it is not expected json but a redirect response. So, authentication endpoint is working as expected but client doesn't redirect. The AuthenticationHandler handler attached on HttpClient should ideally take care of this as per my understanding but doesn't seem to happen. I need to dig in deeper and find out if we need a custom authentication handler .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants