Save user Auth Details from Clientside with Cloud Functions - firebase-realtime-database

I'm building a project in Vue, and I have Auth working on front end, but now I want to save some user data on Firebase Database and I am not sure how to do that using functions since I am doing a server-less backend.
I tried to find an example on how to be able to pass data from client-side to functions api but I couldn't find any.
Looking forward to receive any help from someone,
Regards,
Cheers

Firebase provides you a REST api to do this, check out their documentation in this link.

Related

iOS + Django Database Login Function

I am really stuck and I need your help.
I am working on my web and iOS application. I used also Django to save users to database.
Login function is already working on my web (HTML) but I really don ´t know how to create function to iOS app (Swift).
I enclose also screens of Api HTML and Swift Code. Now it's working only with Facebook. User can sign in using Facebook and order something using iOS App.
I would really like to do the same but with Login Function (not using FB). I hope you can help me. I don't know how to do it and I've read a lot of web.
I would be really glad to you if you can help me.
Please HELP !
Thank you so much.
Image 1 - HTML Urls
Image 2 - Apis
Image 3 - Forms
Image 4 - social_auth_piplines
Image 5 - Models
Image 6 - Swift Apis
This is very broad. There is a lot of questions that need to be answered before I can provide a solid answer but I'll give you an idea on what you have to do.
API
First of all you need an api that serializes the data from your database so it acts as a layer between your app and backend. If you are using Django then take a look at Django Rest Framework which will help you achieve that.
Networking Framework
After setting up your api you need a networking layer in Swift to help you communicate with your api. You can use Swift's URLSession or you can download Alamofire to make things a bit simpler. What a networking layer basically does is fetch the json provided by your Django app and changes it to a Dictionary so you can use it.
In your django Application, you are to specify restframework Authentication to Token. You can get more info about token with django rest auth.
In your iOS.What you need to do is create an AuthServices model. Now in your AuthServices model, you create your login function.
For your login function I assume you are very familiar with Alamofire so you make an API request which would take your parameters and your header which I assume contains a token should also be specified.
Keep your server running and run the application locally if you wish and take username and password with text fields. This should help you go on with it.

How to handle authentication when creating an app that uses Firebase REST

I'm trying to create an application that needs to use a backend. That backend will be used to sync an app created (initially) for iOS, macOS, watchOS. Hope to expand after.
Firebase looks like a nice tool to do that, but it only has so many SDK's. I'd like to unify the codebase as much as possible to utilize code reuse.
Seems like their REST API is the way to go: I just create a framework using REST and we're off: https://firebase.google.com/docs/database/rest/start
However, their authentication doesn't seem to support REST.
How do I get around this limitation? What should I do to get a valid auth token that Firebase will understand?
Please keep in mind that I'm not very experienced with web stuff and even after reading a lot of articles, I'm still confused about how to exactly approach this. For example, this user had a similar concern, but I'm not exactly understanding the answer.
Firebase now officially supports REST API:
https://firebase.google.com/docs/reference/rest/auth/
You can query the Firebase Auth backend through a REST API. This can be used for various operations such as creating new users, signing in existing ones and editing or deleting these users.

Is it feasible to do recommendation with Parse and only iOS devices?

I am currently working on a social-networking based app on iOS. I try the online DB service and cloud service provider "Parse". But what i really do through this platform is just to retrieve data for the "users","messages" and "activities" in that DB.
I want to implement the recommendation function into my app which requires some sort of logic after the retrieval of the data. Is it feasible to integrate some of this logic into the "Parse" platform and avoid setting up the server?
If I understand your question correctly, you are asking if you can have server side logic run on the Parse side? Yes, you can and this is fairly standard practice in the Parse universe. You an use Cloud Code, which is Javascript run on the parse servers and you can link the scripts in to before you save objects, after you save objects, or just standalone functions. Here are some details:
https://parse.com/docs/cloud_code_guide
Hope that helps!

exposing part of my parse.com api to other developers via ouath 2.0

It's now trivial to create a web app that sits atop Parse.com. Now that I have this webapp, I want to expose parts of it to other developers via an oauth accesible api. So, they can develop an app that lets my site users 'give them permission' via oauth and they can now access the api.
How would I start going about doing this?
Update: After #Mubix response, I felt the following clarification would help
Currently I am accessing Parse from the server via a REST api, to get around any javascript security issues re:api keys etc. So, the api would be served of a server other than Parse. Also, the server code is in javascript / nodejs. I came across https://github.com/jaredhanson/oauth2orize which seems a likely candidate, was wondering how others are doing it and if anyone has actually gone a further step and integrated Parse access.
Hmmm .. Intereesting question!
Legal:
First of all their ToS doesn't seem to prohibit what you are trying to do but you should read it carefully before you start.
Implementation:
While parse doesn't provide feature to build your own APIs you could implement something yourself. You could treat the third party developers as users of your app. And you can use the ACL to control access.
Problems:
I don't see any way to implement oAuth entirely within parse.
How will third party apps access your API? Ideally you would like them to use a REST interface but with the parse.com REST API you won't be able to manage access to different parts of your data.
Conclusion:
It seems like too much trouble to implement the API entirely within parse. I would suggest that you write a thin API layer that takes care of auth and uses parse as the backend. You can use one of the service side libraries available for parse. eg. PHP Library, Node Parse.

What is the first step to using a REST API in Rails?

I have just completed Hartl's book on rails. Following the examples have been helpful and I have been able to build some very basic functionality for my app. However, there is this API I would like to use, and have been granted a key for the API. I have absolutely no idea how to start implementing the API. The other stuff surrounding API's have been helpful, but I literally am stuck on what the very first step should be to begin implementing the API.
I need for a user to be able to sign up and authenticate, then supply data that will be tracked through the external API. I've got the user sign up and authenticate stuff down pat, just need to know what the very first baby step to using this API should be.
The logic behind the answer would be equally helpful.
You can use ActiveResource for your model and point it to the external API. This is useful if your model uses an external data source.
http://api.rubyonrails.org/classes/ActiveResource/Base.html
If the external API you want to use is a well known, there is a good chance that there is already a gem for interaction with that API.
If you only need to send some data to the external API but your model does not use it as its source, you can use an HTTP client like Faraday https://github.com/technoweenie/faraday

Resources