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.
Related
I have an android app that uses facebook SDK.
I have a problem with this scenario:
I use the my app for the first time then I log in my facebook account in my app. The credentials are then save in the app so that users will not be ask to log in again. Now, in the facebook app, I log out my account then log in again with a different user. When I go back to my app and retrieve the some user info, it still has the old user in it.
I tried to check it using Profile.getcurrentProfile() but it still contains info on the old user.
Is there any way to detect who's currently using the facebook app?
I have created one app but i want authonticate the user by making user to log in through Facebook..how to make my android app to log in with users Facebook account?
You have to integrate Facebook SDK , follow developer.facebook.com. Try the initial steps.
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.
Is it possible to login into facebook using my own login form in Android & get the facebook user id? I just want to validate the users without need them access their facebook.
In the Android facebook tutorial, the app have to open facebook first so that user can login but there is no automatic close after user login successfully.
Thanks in advance
No, you don't have a way to log the user in through facebook without using their official endpoints.
You can open some sort of browser with the authentication dialog (or the open graph one) but that still mean using their forms/ui (what ever you want to call it).
You should just use the android sdk without using the SSO, that way the sdk won't call the facebook application that is installed on the device (if at all) and will just call the auth dialog for you.
This is a better solution for you since it "abstracts" some things from you, takes care of the access token and more.
Here's a thread about disabling the SSO: How to disable Facebook single sign on for android - Facebook-android-sdk
I want to use the facebook sdk and be able to automatically login after the app has already logged in once.
Currently from what I can gather if you use the facebook api and you have the facebook app installed and you have signed in with the facebook app then you don't have to login and you will be automatically logged in.
But if you don't have the facebook app then this automatic login will not happen. -----------I want to handle this case and be still able to automatically log in after the user has logged in with my app once.-------------. From my understanding the facebook sdk requires you to login if the facebook app is not there.
Also if the user has logged in once with my app, I will have the access token then as long as the access token has not expired then you don't need to log in again. But if the access token expires then you have to log in again.
Any help will be appreciated. Thanks.
The functionality you're describing is called single sign on. Facebook has an entire article dedicated to describing how it works and how to implement it. Enjoy:
http://developers.facebook.com/docs/guides/mobile/android_sso/