Use Facebook authentication for an Android application - android

I am working on an application where I need to integrate the social functionality of Facebook.
What I want is to know if the user is already connected to Facebook through a Facebook application or some other application that uses Facebook, and use this authentication. That means that if the user is already connect to Facebook through his device I recognize that and use it in my application - not ask the user for a new login.
Is it possible?
I found a lot stuff in the web, but nothing is related to that. I already downloaded the facebook SDK and added it to my project. I saw that there is a method (facebook.getAccessToken()) to get the access token, but I think I can use it only if the user do his first login in my application.
Any help would be great.
Thanks.

That means that if the user is already connect to Facebook through his device I recognize that and use it in my application - not ask the user for a new login.
Yes it is possible..This is called as Single-Sign-On in facebook , by default Single-Sign-On is enabled. One and only thing you have to do is that you need to generate Hash Key and Register with your Application created in Facebook.
Also it is possible to disable Single-Single-On by passing an extra parameter as below :
authenticatedFacebook.authorize(context PERMISSIONS,-1,new LoginListener());
-1 - refers disabling SSO
Single-Sign-On is clearly explained in Facebook Documentation..

Related

Login with Facebook option trigger suggest to download an app

Yesterday I logged in to Airbnb with my Facebook account on my OSX. Shortly later I got a notification both on my iPhone and computer saying
"Airbnb is available to install on your iPhone"
My question is, does anyone here know how this was done? Is this a feature available to anyone who creates Facebook login? Any advice on how this was done is well appreciated.
Sincerely
Axel
I bet the notification is sent to you by Airbnb, right? If so, it's pretty easy to do. You give your facebook account information to Airbnb by login with facebook in there webpage. Then they just send a graph api request to facebook with your authorization access token, and you get an notification. For details you can refer to doc here: https://developers.facebook.com/docs/games/notifications
I found out what I was talking about. Facebook is adding a new feature which ask users if they want to get a link to the mobile app.
This is in Beta right now but you will automatically eligible for the feature if:
You have integrated the new Facebook Login on your website. You must be using at least version 2.0 of the Graph API and Login Dialog. Send to Mobile is not available for apps which invoke the Login dialog using Graph API v1.0.
You have integrated Facebook Login into your iOS or Android app. The "Single Sign On" switch within iOS and Android section of your app's dashboard must be set to "Yes"
Added your iOS App Store ID and/or the Android package name under which your app is listed in Google Play to your Facebook app's dashboard.
https://developers.facebook.com/docs/facebook-login/send-to-mobile

LinkedIn integration in Android Using Mobile App

I'm working on LinkedIn ingratiation in my Android app, and I've completed this using simple Webview which will ask for Email and password every time,
what i want to do is getting the Login credential from LinkedIn app (if already installed in device), as in Facebook.
But i'm not able to find any tutorial about it.
Plz help me out.
Thanks
You can not and should not. On Android all apps have a private area to store their data. Unless you have root you can't read another app's data (unless the info is saved to public storage which in this case it is not).
What you should be doing is getting your own authorization by asking the user directly for details and permission and using that. I believe LinkedIn uses OAuth2.0 so look into logging in using that.
You can refer this link:
https://www.studytutorial.in/linkedin-integration-and-login-in-android-tutorial
And also if you are integrating LinkedIn Login in your application, you might face a difficulty that user must have to installed LinkedIn App in his/her mobile. As per the documentaion,
https://developer.linkedin.com/docs/android-sdk
For your reference

Android Facebook Login Issue

In my application, user can login facebook and share my application details. it's work's fine. but when user have a official facebook application and if user is login through that official application or after not log out or start my application and when click on that facebook login, user can automatic login to that facebook login id and password. but i need that in my application user again put user name and their password. how can i do this. please assist me. thank you.
Use this in Facebook authentication method
private void authenticate() {
mFacebook.authorize(this, permissions, Facebook.FORCE_DIALOG_AUTH,
new DialogListener(){
This will help you.
Short answer:
You can't.
Long answer:
Facebook has created SSO (Single Sign On) for the explicit reason of making authentication easy for third-party app users. Not to mention, keeping the actual authentication secure.
To get a User to authenticate with Facebook from a third-party application, there are 3 ways. Technically, 2 ways, but the third is to disable SSO and force a browser based application.
If the User does not have the Facebook Application installed on his device, a Web Page will do the authentication duties.
If the User has the Facebook Application installed on the device, the authentication will be done via SSO.
This last one is used by some developers. This is achieved by using FORCE_DIALOG_AUTH intead of DEFAULT_AUTH_ACTIVITY_CODE where you are doing the authentication part in your app. But this is not recommended as it may open up your app to malicious apps that can steal your user's Facebook credentials (SOURCE: Answer by Jesse Chen, who works at Facebook. https://stackoverflow.com/a/12433933/450534. If you would still like to use it
Bottom line is, you cannot have a user authenticate from your application. You will need to do it using the Facebook way.

How can I create multiple-user access accounts on Facebook Android application.?

I have created an android app for Facebook integration with single user Login. Now i want Multiple user Login in the same application. How can i do this. Please give some suggestions with any android code or usable link. Thanks in advance :)
The facebook android SDK is trying to use the SSO if the device has the facebook application (katana) installed.
If the SSO is used then you have no way of doing so, the authorize method will always use the logged in user in the katana and so you'll have to ask the user to manually logout in the main facebook application.
What you can do is call authorize without the sso as expalined here: How to disable Facebook single sign on for android - Facebook-android-sdk.

How to get facebook authentication from Android login form

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

Categories

Resources