dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.36k stars 9.99k forks source link

Cannot Signin with Identity in Blazor Server Side Application #15429

Closed moritzmla closed 4 years ago

moritzmla commented 4 years ago

I wrote a simple Blazor Server Side Applicationt to test Blazor and I cannot signin' and signup with Identity, any ideas why this is so?

The Error:

1

My SignIn Code:

2

moritzmla commented 4 years ago

Please update the label to area-blazor

mkArtakMSFT commented 4 years ago

Thank you for filing this issue. In order for us to investigate this issue, please provide a minimalistic repro project (ideally a GitHub repo) that illustrates the problem.

moritzmla commented 4 years ago

Ok, here is my Blazor SignIn Component

1

And here is my SignIn Code:

2

The EditForm calls the SignIn Method, i use normal Identity no IdentityServer

if i click on SignIn i get the error from my isssue

javiercn commented 4 years ago

@moritz-mm Seems like you are trying to rewrite the Identity UI in Blazor.

You can't do what you are trying to accomplish as Blazor uses a stateful model and there is no HttpContext available for Identity to use for setting up its cookie.

I'm closing this issue as the recommended way to log-in is to perform a redirect and a form post as in the current default UI.

I'm tagging @blowdart in case he wants to provide guidance about how would someone would write a Blazor-compatible Identity UI.

javiercn commented 4 years ago

Filed https://github.com/aspnet/AspNetCore.Docs/issues/15374 so that the requirements for what is needed to log in a user with Identity are.