Facebook KeyHashes verification in android - android

I am using facebook sdk to request the fb login in my android app.
From what I figured out after reading here, if I have a native fb client installed on my device, than that client gets the signature of my app and then verifies it(or sends it to the server that verifies this) with the key hashes that I have uploaded on my facebook app page.
Now, if I don't have the native facebook app installed, how does it still verifies the same?
I can see a method named setupAppCallForWebFallbackDialog in the ServerProtocol class which calculates the key hash of the current package and passes it to the web dialog.
Now, we know that we can get the signature of any package in android in any app using PacakgeManager.
So, if I clone the facebook sdk from here and then hardcode it to calculate the signature of a particular app and I am using that app's application id in my project, can I ask the user to login on that app's behalf? Am I missing something here?

Related

Phone Gap Facebook Plugin not working properly via native Facebook App and getLoginStatus() is giving Unknown Status on Android

I am using phonegap-facebook-plugin to share the feed dialog in my Ionic app. I am testing this with the test users of my app generated in Facebook developer account. This plugin is not sharing the feed via native Facebook app installed on phone. When I don't have the native Facebook app it works fine. But we want to implement this through native Facebook app.
Second when I am trying to use the method getLoginStatus() and test user is logged in Facebook app then it is giving me response "unknown". But this response should not be there as I am already logged in. For your reference https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus
You need to first generate the right key hash and put it on Facebook developer account. And then if you are getting 4201 error use this -
Goto plugin.xml file of Cordova Facebook. Change the $APP_ID and $APP_name with the App Id and App name. It worked for me.

When android facebook Development Key Hashes has validity

I'm having trouble with facebook development key hash.
I try to share content into facebook using Feed Dialog as fallback
as showing in Facebook quick start page. I've already done whole step set for adding facebook SDK in my Android project.
I've set a development key hash of application and add it into "Add your development and release key hashes" field, after I generated debug apk file of application.
Trying sharing with my device where Facebook app is running with my developer account logged (the same on which i've registered the application) all works fine.
When i trying to sharing content with another device where is running Facebook app, but with different Facebook account error
com.facebook.FacebookAuthorizationException: This app has no Android
key hashes configured. Configure your app key hashes at -my application settings page-
My question is development key hash is limited only for developer testing so it works only with developer account interactions?
Ps: I made application public and available to all users on settings account, I set a development key hash given by application installed on test devices, but i didn't set any release key hash.
Login to facebook dev account and go to status and reviews under app sections and tick (Do you want to make this app and its all features available to general public to yes )
you need to define the hash keys on the facebook developer site which will be acheived from ur code programmatically.
it with sync with package name.
You can dive into your app management,and getting started,as such:
https://developers.facebook.com/quickstarts/664900340309697/?platform=android
then it has some steps,you should step by step and config your app's package name and lancher activity just finished.

How does Facebook verifies mobile apps

Assume that you build a native android app which uses Facebook login. For that first you have to build a Facebook app and configure Package Name, Class Name, Key Hashes of your android app. I assume the authenticity of app is validated through this Key hash. but the problem is after we configure this key in Facebook app, we never configure it in our mobile app or send it to Facebook when we make API calls. So how does the Facebook validates that this is the original app which is making the API call?
Whenever you put an app onto a device (whether via eclipse/IntelliJ or by building a .apk) you're signing it with a key. When you log in via Facebook using SSO, the native Facebook app can get the signature of the calling app, and passes it to the server to get verified.

Issue in getting access token from installed Facebook Android app

I am using Facebook SDK 3.0 for authentication. It works fine when facebook app is not installed on the device. If the facebook app is already installed on the device, I am unable to fetch the Access token value.
I am using the same code given in helloFacebookSampleActivity.java in the tutorial.
This is due to the Single Sign-On feature provided by facebook. It allows user to sign in to your app if he/she is already logged-in, in the native facebook app, without having to re-enter the username and password.
To get this working you have to submit your Android key hash to your facebook profile. For more information on this please read the Step 4 given here.

Switching between facebook apps on Android?

I'm integrating some facebook features within an android app. For testing I've made a facebook app of my own, but its likely that the client will create his own fb app and want me to swap the info of my app with theirs after the testing is done.
Since for android, you need to provide a signature/hash key to your android app in your facebook app dashboard, does this mean that my android app is always tied to the same facebook app, or can the credentials easily be swapped in future?
As long as the app is still in development and not already released to the Android Play store, you can always just change the value of your APP_ID in the app to replace yours with the client's fb app id. The signature/hash key should be the same as long as you're building the app on the same machine.
So when your app is ready for the client,
have them tell you the app id so that you can replace it in the code
give them the android key hash that you are signing the app with (make sure that you use the correct key and not the android debug key if this version of your app is going live into the app store) so that they can put it in their app dashboard on Facebook.
I think that is about all the steps necessary to solve your issue. Let me know if that helps.
You can put your signature/hash key in any number of facebook apps so there should be no problem.
Furthermore, the facebook app can have as many android signature/hash keys and can be replaced anytime. Try it in the dashboard to confirm.

Categories

Resources