1

So much has changed since I last did any development so please bear with me,

Overview

My knowledge level

Been picking up C# in assisting bug hunting in a server-hosted application, before this it was Java for IRC bots and PHP 5.6. (Oof, I just made myself feel old)

Backstory

I've been building my knowledge and reading various tutorials and Microsoft Documentation (Which has caused me so much more confusion as to what I need/want) that I want to settle on a RESTful data flow like the image below.

Data Access Model that shows relationship from Client to Blazor Server to RESTful server to database and back again

I found tutorials (Example from Pragim - I followed the text, not videos) and it talks about ASP.Net Core Identity on the Blazor Server level. To me, it makes more sense to move it to the RESTful server (Which I now understand use the ASP.Net WebAPI) level, since I want to be able to later develop different front end, for example, a front end Android app later on and still maintain the same backend for authorization, authentication, and data management.

I've looked around for more tutorials and found Securing Client-Side Blazor with WebApi tutorial but it talks about Blazor WebAssembly. I'm feeling overloaded with too much information.

Goal

I want to provide a loosely coupled Management System to help me manage my first responder volunteer unit. Unit members would use the system for tracking their hours, seeing and tracking certification expiry, leadership in various roles and levels would use it to see reports of hours, sending notification in the chain of command way, and other features I feel the system needs. Similar to an employee management system.

There's also a possibility of growing from my local unit of up to 50 members, to a council of 3-5 units, and a rare possibility of nationwide hence my need to be loosely coupled as the tech at different levels may need to be swapped out although that's beyond the scope of current development, the scope is to learn and have a working system for my unit, I feel the need to design in a way that growing/adapting is easier.

My understanding of Blazor WebAss vs Blazor Server hosting is that WebAss download all of the logic, while the Server rendered the content on the server-side and only the change is sent and I went with the server since it could be accessed via devices that are on wireless access like 4G, etc and reducing bandwidth and processing usage is key. I am settled on using ASP.Net, C# as full-stack as I can. Blazor Server and Web API are separate but locally hosted.

==============

Summary TL;DR:

How to use Blazor Server Hosted to access WebAPI server to authenticate/authorize? Is it even possible to allow sign up with external services like Google, Microsoft, and Facebook with this setup?

3
  • So, the TLDR is "if I have a Blazor Anyside that talks to a REST api, how do I get the API to do auth so that future things eg a mobile app, can also talk to the API and do auth"? Commented Mar 2, 2022 at 18:56
  • Forgive my ADHD and my poor ability to summarize. I've somewhat figured out how to do the API side, but how to get Blazor Server-Side to use the API for auth. I felt like Blazor Server-Side would have been the better route based on what I read and learned. Based on the answer from RY4N, I guess I'm wrong? Note: Blazor server and the restful API are locally hosted to start with. Commented Mar 2, 2022 at 19:10
  • Edited my TL;DR and added a note in the block of text that Web server and Web API are separate but locally hosted. Commented Mar 2, 2022 at 19:15

1 Answer 1

1

The short answer is Yes, you can call external API's in the same app, use Identity and Identity already has the ability to authenticate via google/ms/fb.

However Blazor server is prone to latency(it would matter where the server is) and requires a decent connection. I would question its place here.

Blazor webassembly is a client side UI framework and it would be easier later if you where inclined to removed it as your webapi is separate.

Sign up to request clarification or add additional context in comments.

7 Comments

A lot of this answer(the wasm vs ssb bit) is accessory to the question being asked
If I'm using the take away from the accessory part of this answer, the WASM vs SSB part. Are you saying that SSB is much more suitable for a client on unstable connections like mobile phones?
@AbbySM The opposite. SSB is good for stable connections it relies on signalR.
So the use of SignalR is the cause of errors for unstable connections. Hmm, a slow first load seems it would be an issue for slow connection/mobile devices but the bigger issue is the use is SignalR?
SignalR is not the cause of unstable connections but it doesn't tolerate them well, if you are on a mobile network where coverage varies would be the issue using Because SignalR / blazor server side are in constant connection to listen for UI updates.....interuptions in connection require a full reload of the website. Where as blazor webasm would just rely on rest (web API) for more data after having been downloaded once... it wouldn't need to be in constant connection.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.