How can i get firebase data automatically using window service - c#

Before this, i had tried to get firebase data, and that's work when i initialized firebase app using angular typescript.
But for now, i need to get firebase data automatically by schedule, and i tried to create window service using c#, Also working when i follow this tutorial that i found https://www.c-sharpcorner.com/article/create-windows-services-in-c-sharp/
The problem is, I not found any tutorial how to initialize firebase app using c#, all tutorial is using service account to get firebase data.
But how can i initialize firebase app without service account using c#? because i only get this firebase config as below from firebase owner.
const firebaseConfig = {
apiKey: "apkey",
authDomain: authdomain",
databaseURL: "databaseurl",
projectId: "projectid",
storageBucket: "storragebucket",
messagingSenderId: "messagesenderid",
appId: "appid",
measurementId: "measurementid"
};
i had try to find the solution, but not found anything,
or is there a way to create a window service from angular typescript?
I would be glad for any help.

If you are writing backend or desktop code to access Firebase products, you will not be able to use the configuration objects provided for web or mobile applications. You must use a service account to initialize any SDK you're using. The web and mobile SDKs are built for use by end users that require authetnication, but backend code is not driven by end users. The service account effectively authenticates and authorizes backend code to access Firebase products.

Related

How to sign up users to azure ad using xamarinforms and graph API

Hi guys I am a bit new to azure, so im trying to implement a sign up functionality on my mobile xamarinforms app, I'm not quite sure if I need to use graph API https://graph.microsoft.com/v1.0/users to register my users through the app using this API, the challenge i am facing is that if I use the API it needs a token which I don't know which token needs to be passed since a new user is registering to my app to gain access. Is there a docs that can help or I need to use a different approach to signup users to my app?
For getting the access token:
Microsoft identity platform authentication libraries for mobile applications:
Please refer this documment:https://learn.microsoft.com/en-us/azure/active-directory/develop/reference-v2-libraries#mobile-application

How to add Microsoft Identity/Azure AD login feature for my React/.NET Core 3.0 SPA web application

I'm developing a web application with a ReactJS front end and a .NET Core 3.0 backend. To create it, I followed this tutorial, pretty much: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-3.0 .
Currently I'm storing the users in a database hosted in Azure cloud. In the backend code's ConfigureServices() method in the Startup class, I connect to my database like this:
services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
Now, management wants to make the change so that the users are not stored in our own database but rather in Microsoft Identity (formerly called Azure Active Directory (Azure AD)). This is because lots of companies already have user accounts there and they wouldn't have to create new users.
Can someone tell me how I can transition to that destination from where I am now? I see some tutorials where I create a web application like that from scratch but I have the feeling I could change just a few lines of code of what I already have and make this change. Anyone?
I'm not sure if you only need to change just a few lines of code, but based on your requirement, you are looking for a way to integrate Azure AD Authentication into your ReactJS application to call your backend API application which is protected by Azure AD.
There are two steps:
1.Protect your webapi(server) with azure ad. You can refer to this step (TodoListService).
2.Get access token from your react app(client), then access webapi with the token. You need to register the client Azure AD app with adding permission to access the webapi application. See this step (TodoListClient).
There are no ready-made code examples for you to use directly. But you can refer to this tutorial and source code on how to use MSAL with React to call Microsoft Graph.
The only thing you need to modify is calling your own API instead of calling Microsoft Graph here.

Can Web Application Retrieve Data from Firebase Database using C#?

I have an Android mobile application that used to upload image and text to Firebase Database. Now, I have another web application that using C#, this is used to retrieve the data (which uploaded by the mobile app) from the Firebase. I found some examples regarding on how to retrieve data using C#, but it needs to "Add Firebase to your Web App" . Is it possible that not adding web app? Thank you.
I mean, is it possible that my mobile and web applications use the same Firebase Database/Storage, and both applications can add, edit, delete the data in the same Firebase Database/Storage?
Yes, it is possible to have an ios and web application using the same realtime database and same storage.
From the firebase docs:
The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. When you build cross-platform apps with our iOS, Android, and JavaScript SDKs, all of your clients share one Realtime Database instance and automatically receive updates with the newest data.
To add web or ios to the project, you need to go to the firebase console and then click on add another app and choose if ios/android/web and just follow the steps.

How can I use the Live SDK on the client to login to my own Web API?

Fellow programmers,
It is hard for me to wrap my head around this whole token based OAuth authorization flow so please forgive me my eventual stupidity and broken english (I'm from Poland).
I'm developing a web service using .NET's Web API 2 technology and 2 native clients: Windows Store (8.1) & Windows Phone 8.1.
Some controllers on the API side of course need authorization. I want the users not to be forced to create a new account in my system with seperate login data so I've decided to use Microsoft authentication.
I've created an application on Live.com developers and got my client ID & secret. Then I've enabled the Microsoft authentication in App_Start\Startup.Auth.cs with correct ID & secret.
Now, I've made a native client (Win Store app) using Live SDK 5.6 (newest available) and associated it with the store. I managed to sign in to my account in the client using that SDK and get some basic data about me just for testing purposes.
But that's all I managed to do. My question is:
How can I use the Live SDK on the client to login to my own Web API? What's the flow?
I've found this:
http://leastprivilege.com/2013/02/02/asp-net-web-api-authentication-using-the-microsoft-account/
And it says I have to send the authentication token to my service using auth header, but my authentication token in null, I only have the access token. Also, to which URL do I send it?
Some other "useful" info about what I've done (will update):
When creating the LiveAuthClient I didn't give the constructor any redirect URL

Looking to create a webservice for client authentication and need some advice

I am developing an android application to accommodate some desktop software that I created. I would like for the user of the mobile app to have to verify their identity through authentication. Basically the web service will have to act as a central hub to both authenticate and hold information that the android app will need. The way I think it should work is to
-Set up a central web service
-Allow user to create account from desktop client using email/password
-The desktop client will send the information to the webservice that the android app will need.
-when android app is authenticated it will then retrieve the data it needs that was posted from the client.
So basically the service will need to be able to send and receive data.
I will only be using .net (either C# or vb.net ) for the service, so this leads me to a couple of questions:
Should I be using WCF for this? If so should I create a WCF Service library or WCF Service application?
Should I be using the Sign Sign on service approach?
The web service doesn't need to be fancy it just needs to get the job done. Is their any boilerplate project templates or projects out their I could use to help build a foundation?
I recently discovered SudzC.com which generates classes and methods for Objective-C from the wsdl data of a .net web service, and I'm fairly sure it also does Android.
I have a huge catalog of fairly 'old' web services which pre-date WCF and they are currently working perfectly.
I should point out though that the SudzC service only shows you what it can do for you for free - to get the code you have to pay ~£20 for a one year pass.
We had something similar where I worked. We had to put together an Android app for the company. If you are on .net 4.0 or newer, you can take advantage of theWebApi. It can return json or xml. So, that means any platform can utilize it (desktiop, android, etc...). I found it extremely easy to use, with very little overhead.

Categories