I have an Android app using Cloud Firestore (Blaze Plan). By calling Firebase Call functions from the Android app I can easily send text from the client and receive answers from the server.
According to the Facebook docs regarding Access Tokens, it is possible to get information from the Facebook Graph API by using an App Access Token, without requiring the user to be logged to his Facebook account (if any).
Is it possible to make requests to the Facebook Graph API from a Firebase cloud function (using JS)?
Yes, you can make requests to the Facebook graph API from a Firebase function. There are very few examples, but a good one may be this (you can find the code here), and this has been explored in other threads like this one.
Hope you find this helpful.
Related
This question might sound silly to some, my scenario was that i had to implement facebook login in my mobile app.
I added to my project:
Facebook SDK
Firebase authentication SDK
Implement both Facebook login and Firebase authentication mechanism for facebook.
Couldn't i just implement facebook SDK and implement the login?
I understand the benefit of receiving statistics about users and logins from different social networks in one place.
Are there more benefits i am missing?
You're most likely to use Firebase Authentication if you
Use other Firebase products, which integrate with it. For example Cloud Firestore integrates with Firebase Authentication to provide a server-side security model, while allowing direct database access from the client.
Use multiple providers, and want to link them together. Firebase Authentication allows accounts to be linked, so that a user ends up with one profile, no matter if they sign in with Facebook today, and with Google tomorrow.
I'm integrating Stripe Payment Gateway to an Android App and facing some questions and issues.
Following the Stripe Documentation it seems like having its own Server is required.
Digging for a few Hours, Firebase Cloud Functions can do the Server work...Great !!
But from what I can find, it can be done in at least two ways:
HTTP Trigger
A write to Firebase Database that would trigger a Cloud Function
So first, which one to use?
The good old Industry trusted http endpoint with good old Retrofit?
Or the much more simple Write to Firebase Database to trigger the function?
Also, as for the next step, I could not find any Android tutorial for the next steps. Only this Web app: https://github.com/firebase/functions-samples/tree/master/stripe.
From what I can see, it would need Node.js, npm etc etc...
Nothing more simple from Google?
Cheers guys
First of all, either way you're going to have to write backend code in JavaScript to handle payments.
So the process that works for us with Cloud Functions is -
1) Android provides card details to Stripe using native SDK
2) Stripe provides a token which Android sends it to your Firebase backend
you could store it in stripeTokens/userId/yourToken
3) Firebase cloud function then triggers a function and uses this token to create Stripe customer (See saving for later and Customer)
you could store it in stripe_customers/userId/stripeCustomerId
4) Remember to remove yourToken because it's only valid once
5) finally you can use this stripeCustomerId to make payments and update related nodes in the backend
Important concept here is to create a customer and store it in your backend for future payments.
So steps after 2) are all cloud functions, so yes most of the work is done in backend. Only thing Android is doing is entering card details, sending token, triggering and listening for future charges.
As far as HTTP is concerned, concept is similar but only thing different is you wait for the response and if there is any errors you get it there, whereas if you were to do with Cloud Functions, you would have to write those errors somewhere and read those from client.
Hope this helps.
i'm creating an android app, which requires some authentication system. I want to have 3 options to log in users: mail&password, facebook login and anonymous access (in case of anonymous i'll create some kind of anonymous account, so user'll be able to give his credentials later and secure his account with 'normal' password).
I'll also have my own webservice for this app. Webservice is in fact the most crucial part and android app will just show data from WS and put some new data on it.
I'll be using Firebase for handling notifications.
My question is: should i use Firebase authentication in this scenario or maybe it's better to stay with own authentication system? If i use Firebase i still need to have users in my database (webservice requires some info about users).
Is firebase authentication good choice for project like that?
Even in the case of Firebase where we use firebase authentication and the firebase database together, only a few details of user(user id, login email or number, provider details etc) are available under the Authentication tab. The rest of the details we receive after login and other custom user information we collect from the app have to be saved in the Firebase database.
So even if you have another Web service instead of using Firebase Database, you can use Firebase Authentication. There are definitely great advantages if you use Firebase Authentication.
Save time on developing Webservice methods for authentication :
Instead, you can just have a method to store user information after the user authenticates with Firebase. Also, there is considerable time saved since you can avoid developing server-side methods for different kinds of token verification in case you want to add social logins like Facebook and Google.
All that will be handled efficiently with Firebase.
Detailed Analytics: Also with Firebase authentication, you can also get good analytics and demographic information of users.
You don't have to use Firebase authentication in order to use FireBase Push Notifications, Invites, etc.
That's one of the beauties of Firebase; you can choose which service to use.
Since everything is built already, I would continue to use your own Auth system
You can save all users, and you can authenticate with Google, Facebook, only email.
It's like a database online and it's easy to connect with the same at Android Studio and after you can login with the users.
Want to post some photos or link on user Facebook wall without using FBSDKShareDialog. I am already post with using the FBSDKSharePhoto And FBSDKShareDialog defult dialog from facebook. For that I do the below code.
If you don't want to use the dialogs (regardless of whether you invoke them using the SDK or your own code), you will have to resort to using Graph API.
In order to create posts using Graph API, you will have to POST to the /me/feed endpoint (docs), but that requires an access token.
In order to obtain an access token from Facebook, you need to implement Facebook login, and their Platform Policy section 7.2 says:
Native iOS and Android apps that implement Facebook Login must use our official SDKs for login.
So in the end, you might as well use their SDK after all, or risk your app getting blocked.
However, assuming you have an access token and you are using the SDK (but not the dialog - since that is what you are actually asking), you can use this docs section to learn about how you can make Graph API calls using the SDK.
I'm writing an android program which must interact with google documents, so I have watched this sample, but it uses an AuthSub token. How can I get an AuthSub Token from an android app?
For accessing Google Docs or any other Google service (or any OAuth based service for that matter) you will need to find a way to do an OAuth based authentication, after which you can u get a secure token which you can use to access a service based on the users credentials.
There are some really good examples to get you started:
This is an example of getting AccountManager to work with a Google
service like Google Tasks, this shows you how to generate tokens and
then how to use them:
https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android
This is an in-depth look into how you can authenticate based on the
users Android credentials, has an example of how things work and how
the UI should be:
http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2
For something specific to Google Docs have a look at
http://code.google.com/p/google-api-java-client/wiki/Android
http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs/DocumentResumableUploadDemo.java