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.
Related
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?
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.
I am trying to access Picasa Albums using PicasawebService. This service requires authentication. How do I do this from an Android device, similar to what I have to do with Facebook Authentication?
What I mean is that Facebook SDK 4.x has a LoginManager, where I specify that I want to Login to my Facebook account with certain access privileges. If I am not currently logged in into my FB account, then FB login will show up, then it will ask me if I want to allow the user to access that was requested by the LoginManager.
On an Android device, I am already logged in, since I have to have a google account to have an Android device. Can someone point me to some sample code that will accomplish the above.
Thank You,
Hello I'm creating an app that there is a log in and sign up screen. In the sign up if a user sign's in using Facebook, and later log of - he will go to log in screen. There is a log in using Facebook button, and when a user tries to log in, Facebook gives me an error and Okay button. I think this is because the user already has given the app permissions(or something like that). Now my question is how can I create the log in function if a user has already signed in using Facebook.
For Login/Logout purpose you can use Facebook SDK 3.0, it uses information from Facebook App on Android (if it is installed), so if the user has already signed in using the Facebook App, then the user would not have to sign-in again, the SDK will simply fetch the current Session.
I have answered the detailed implementation for this on the link below:
Post to facebook after login fails Android
Thanks.
Hello I am using the facebook sdk for android on my android phone and using single sign on. It works fine when I logged into the facebook application, my application also signed in.
For logout I encountered a confusion.
The way I implemented was restore the access token and expired date from the user preferences of the application and check the validity of the session. If expired the application calls the facebook.authorized function and once authorized the access token and expired date will update again.
There are few things I find a bit confusion when dealing with the logout.
1) When I logged out from facebook application, my application still can get through and request the user details. Although, my saved access token on my application has no relationship with the facebook application, I thought it will at least giving me an error when requesting the data. But it hasn't given me the error.
Does it suppose to be actting like that. Signing out from facebook apps will not affect the access token I have stored on my application.
2) When I logged out from my application and not the facebook application, the facebook application won't automatically logout.
The Facebook access token and your app access token are separate and distinct, so it is entirely possible that one can be valid and allow access while the other is not valid and will require re-authorisation.
If the Facebook app is logged in but your app is not, then the Facebook SDK will use the existing Facebook app login to obtain a new access token for your app without authenticating, but this is still not linked to the Facebook app login token in any way.
If the Facebook app is not installed, or not logged in, then the Facebook SDK will take you to the Facebook website to do the initial authentication, but this does not log the Facebook app in because there is no connection between your access token and the Facebook access token.
So, in summary - your understanding is correct. There's no interaction between the two apps except for when your app tries to authenticate a user, then the Facebook app will act as a proxy, allowing you to gain access without authenticating so long as Facebook is logged in. After that, there is no further interaction and what you've observed is expected and intended behaviour.
I have the same problem. I'm thinking about creating a "isLogged" var and store it so that when someone logout and restart the app it will not even verify if the user is logged bypassing facebook's session verify.