Is it possible: Using Blazor serverside as a client app - blazor-server-side

There is a ready azure microservices that I need to build a client app against. There are 2 choices blazor server side and client side. Because the client side is not ready yet and has limited debugging capabilities I want to use blazor server side.
My question is if calling services from blazor server side is possible and if it is a good idea. To use it as a client app?
And also if it is possible to host blazor next to the microservices in azure?

I believe what you are asking is if it's acceptable to use the Blazor server side as a proxy to a microservice?
Technically, there's no reason that you couldn't. You would simply create an HttpClient to call your Microservice assuming that it exposes a REST API.
I'm not sure what you mean by, "..if it is possible to host blazor next to microservices in azure?" If you're using an Azure Web App to host your microservice, you would probably want to create a new Web App for your blazor server side app, otherwise you aren't really getting the benefit from the app service.
There are other options for configuring this type of architecture, but it all depends on your goals. Additionally, you might want to check out the following project:
https://github.com/Suchiman/BlazorDualMode
It will let you run blazor client and server side together. I've used it to help debug client side blazor apps.

Related

Windows Authentication in Blazor WASM

I am implementing a WebApp in our company's intranet with Blazor WebAssembly. I need to make API-Calls to our DevOps Server hosted in our intranet and need to use Windows Authentication to access the API. In the former used WPF Client it was enough to just add the UseDefaultCredentials-Flag on the HttpClient, but that does not work in WebAssembly anymore since the App is running in the browser. The Microsoft Docs state We don't recommend using Windows Authentication with Blazor Webassembly, but not recommend does not mean not support, so it has to be possible somehow, to attach the current App-User's Windows Credentials(Token) to the API Call. Unfortunately there exists no example on the docs page on how to implement this and I have not found any code on how to tackle this, although on some forums people wrote that it is possible, but did not include the How in their comments.
I am using .NET5 for both Server and Client and need to make the Api-Call with Windows Authentication from the Client, not the Server as most examples are using it, as my Server-Project uses the same User for all Requests but I need the User of the Client-Project.
Any kind of help is appreciated.

Can I co-host both Blazor Server and Blazor WASM Client as 2 deployment instances for the same app on production?

Blazor WASM has its advantages like speed on client side (after initial pre-load), offline support and can be served via CDNs.
But, Blazor WASM isn't suitable for SEO, pre-rendering doesn't really solve the issue because then the app essentially becomes Blazor Server which always has an open SignalR connection and needs a server round trip for each button click.
Can I host both versions of the app, and do some URL/DNS Routing magic so that the search crawlers use Blazor Server, but humans interact with Blazor WASM Client. I am looking for best of both worlds from a user experience standpoint.
Both Speed and SEO are critical in our project.
References: https://learn.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-5.0
Thanks in advance!

Recommendation needed for cross platform authentication .net core MVC and Xamarin

I need to create an application (Mobile) and a Web application. It needs to use the same database so the same user authentication is required.
Can anyone give me such a demo or an idea where to begin.
I have looked into identity but I see that it is not compatible with Xamarin.
Expected result would be a cross platform login provider
my recommendation is to create one web service that can connect to the db and your mobile app and web app make http get/post calls to the web service. This also means you get to keep db logic in one place instead of duplicated across the applications.
The web app and mobile app should get some kind of authorization token (such as bearer) from the webservice to ensure no ones else is hitting the api.

Creating a Web Proxy for Mobile Clients (HTML5 Web App)

I'm currently developing an HTML5 mobile web app for Blackberry using WebWorks that interacts with a 3rd party API.
Unfortunately i can't use the API directly from the mobile app due to the cross domain requests constraints, so i'm considering the development of a Web Proxy that interacts with the API and serves the web app.
Since I've never done such thing i would like to get some recommendations, i'm going to use Microsoft technologies (.NET) to achieve my purpose.
I'm thinking about a WCF service that makes all requests to the API and the mobile client connects to the WCF service to get the data, but i think i'll have the same cross domain requests limitation anyway so it might not work.
First, check with your third-party API provider if they support CORS. If they do, you can get around the same origin policy restrictions. Assuming they don't, you can create a facade service using ASP.NET Web API instead of WCF. ASP.NET Web API is designed from the ground up for creating HTTP services for broader reach and there is no SOAP involved.
From your ASP.NET Web API, you can make a HTTP call using HttpClient and simply pass the request to the third party API and echo the response back to your app. As you rightly said, the same origin policy restrictions will apply to this case as well but you have more control over the server side. You can implement CORS in ASP.NET Web API and that way your BB WW app can still call your web API despite being in different origins.

App to app communication and security

I have client apps that talk to my silverlight application and its web services. So the client app is running on the client machine and making calls directly to the silverlight app running on the machine and also making web service calls.
I want the usernames/password security to be handled by the 3rd party client app.
Any idea how I can do this?
I'd try the Application Scenario's, Guidelines and How Tos sections of this CodePlex Link. You should be able to find a scenario that matches closely to yours and follow the guidelines and configuration to get yourself going.
If I've understood this correctly, the client application would pass a username/password to your silverlight app which would require a wsHttpBinding that has clientCredentials="Username". You would need to be able to authenticate this against a user store configured on your server, for example you could configure a SQL Server provider.
I'm not sure how your 3rd party client app works, but you would require a seperate security configuration for that communication. You could use a less secure binding if the apps were on the same machine and possibly use clientCredentials="Windows"/"None"/"Basic".
Difficult to advise further without knowing your exact situation. What do you have so far?