Scaffolding failing for identity in blazor

NOVATROOP77 256 Reputation points
2021-09-14T14:22:23.8+00:00

When I try to add identity thru the cli cause the tooling is broken form the gui I get this error. I am using Blazor / Client Server. I persume I would scaffold my identity pages to the client.

Inference.targets(188,5): error NETSDK1032: The RuntimeIdentifier platform 'browser-wasm' and the PlatformTarget 'x64'
must be compatible.

I am running the scaffolding via this method

dotnet aspnet-codegenerator identity

As when I run it from the GuI it throws an error.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,403 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,306 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 56,926 Reputation points
    2021-09-14T14:50:00.033+00:00

    Blazor Client (WASM) projects do not support database scaffolding as the browser does not have database support.

    A blazor client would typically use oauth, and the login server project would be the one to support identity database scaffolding. That is the clamor client would call a login server and get a JWT token, that it passed as a bearer token when calling a webapi.

    Note. If you used cookie authentication, the the host of the index.html static file would implement cookie authentication.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,926 Reputation points
    2021-09-14T22:47:49.793+00:00

    Blazor client apps are a static web site. The blazor code can use HttpClient to call a login service to get a token (or use an iframe and host an open api login page).

    to have a login server you create a separate asp.net core project to be the login server. you add this to the solution. as the blazor project is a static website, the server project can host, instead of a separate webserver.

    you can manually deploy the blazor project to the server project wwwroot or use the new combined project (which nests the blazor project in the server project).

    https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-identity-server?view=aspnetcore-5.0&tabs=visual-studio

    0 comments No comments