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

Add template for Blazor Web App with Web Api backend #59433

Open
1 task done
MarvinKlein1508 opened this issue Dec 11, 2024 · 0 comments
Open
1 task done

Add template for Blazor Web App with Web Api backend #59433

MarvinKlein1508 opened this issue Dec 11, 2024 · 0 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@MarvinKlein1508
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

A common scenario for web applications is to use a Web API as the backend, which is then consumed by various projects. For instance, in my case, I am using a Blazor Server app for the frontend, and I want all data access to be handled exclusively through the Web API.

To implement this, I can simply add a Web API project to my solution and inject an HttpClient into my pages. However, even this straightforward approach requires some additional configuration, such as setting the Web API URL in appsettings, assigning it to the HttpClient, and creating a startup profile to launch both the Blazor app and the Web API simultaneously.

The situation becomes even more complex when authorization is introduced. Naturally, you wouldn't want every endpoint in the Web API to be accessible by unauthorized users. However, integrating both projects with proper authorization can quickly become a challenging task. Right now you can add Identity to all Blazor rendering modes but this always results in the data access being bundled with the Blazor app.

I believe the ASP.NET Core platform could greatly benefit from a dedicated template for this setup, as many small businesses rely on this approach.

The template would allow small businesses to start their projects even quicker.

Describe the solution you'd like

Basically what I want to achieve is:

  • Web API with Identity support which is being used to authorize my Blazor apps (Perhaps even with JWTs)
  • Blazor Web App (Server, SSR or WASM) to consume the API and use the Identity endpoints of the Web Api for authorization

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

1 participant