Comments (16)
You can use an access_token with the old REST API as well as the new Graph API, so there's no need for a session_key.
from facebook-android-sdk.
I had the same problem and when I dealt with it it didn't appear to work the access_token as the session_key (perhaps it is working now I just cannot test it right now) but I found that you can get the session key by hooking into the FbDialog.FbWebViewClient.onPageStarted event. When the URL contains a /authorize_success then the session key is being passed in the query string.
It is then easy to retrieve it by doing:
Uri uri = Uri.parse(url);
JSONObject session = new JSONObject(uri.getQueryParameter("session"));
String sessionKey = session.getString("session_key");
I actually didn't add that directly in the onPageStarted method but delegated on the DialogListener with a new event I created.
But if the access_token works as a session_key then it is much easier and cleaner. Otherwise I can provide the modifications I made if they are useful or someone needs them
from facebook-android-sdk.
I am currently using demianalonso's workaround, but I'd like to request official support for session_keys. It would be quite a bit of trouble for my client to rework his entire API to use access_tokens instead...
from facebook-android-sdk.
Demian- that workaround will break in the near future when we refactor the auth flow to remove that redirect. If you have any deployed apps they will break too.
Paulfake - you have two choices. You can switch to use access token (generally simpler than sessions), or you can leave your code as is. The switch should not be very extensive, even if you are using the API in lots of places.
from facebook-android-sdk.
Hi lshepard, thanks for the reply. We tried to use the access token instead of the session key and they doesn't seem to be interchangeable.
I must noticed that my scenario might not be the most trivial one. We have an android application which relies on a server application which performs some operations. But the server is implemented using the REST API where as the client is using the Graph API, and that's why we needed to fetch the session_key so the user can log in using the Graph API but the server can still work with the older API.
I do understand that eventually the server should be migrated to use the Graph API but we were trying to ease the transition by migrating each part separatedly.
Is there an official way to do this or it is something meant to be a workaround?
Thanks for all the help.
from facebook-android-sdk.
The Auth Keys do not work in the case of XMPP Chat integration with facebook connect. I have migrated my entire app over to the graph API and now this has broken chat!! ARGGHHH!!
from facebook-android-sdk.
Looks like the patch is no longer functional and since yesterday, so the app cannot connect to the XMPP chat stream anymore
since it cannot extract the session key and secret from the authorize_success part. They are no longer there :-(
Can the Jabber endpoint accept an OAuth 2.0 access token?
What is the official way to access the XMPP stream?
Thanks
from facebook-android-sdk.
Why has this been closed if there is not solution to it? For us who want to connect to XMPP chat there is no way to do it without a session key.
Can this be incorporated into the SDK anyway? For example having the REST API included like the iOS SDK.
Currently the only way to do it would be to use fbconnect-android which has a limitless amount of problems.
Having the REST API added would be a godsend.
Thanks
from facebook-android-sdk.
Could someone please be kind enough to add a method to get the session key. I'm trying to integrate xmpp chat into my application.
Please help. :)
from facebook-android-sdk.
Same here, Can any one give the code that implements demianalonso solution. I will be very thankful.
from facebook-android-sdk.
I tried to get the information as mentioned but I am getting null pointer on
uri.getQueryParameter("session") please help
from facebook-android-sdk.
It doesn't work anymore.
from facebook-android-sdk.
:( so how will I get session_key, or i have to use FBConnet ???
from facebook-android-sdk.
CodeCarpet's FBConnect API
try his code :) I'm not sure if it works, I'm gonna try it today and see.
from facebook-android-sdk.
When using facebook android sdk with SingleSignOn (SSO), the access token format actually changed.
Instead of getting traditional auth token which contains userid & session key as a part of authToken
now we get a different format of authToken
As Facebook Devs are still in process to support there rest apis with newly formated access token
meanwhile we can disable the SSO on android facebook sdk by changing DEFAULT_AUTH_ACTIVITY_CODE to -1 from 32665 (in Facebook.java)
This will invoke Traditional dialouge for granting acess token and in return you'll get access token which will contain session key in it.
from facebook-android-sdk.
Those who are looking for generating secure session key you need to add your own method in Facebook.java like
public String getSessionSecret(String accessToken) throws MalformedURLException, IOException
{
Bundle b = new Bundle();
b.putString("method", "auth.promoteSession");
b.putString("access_token", accessToken);
b.putString("session_key_only", "true");
String response = request(b);
return response;
}
from facebook-android-sdk.
Related Issues (20)
- Unexpected "Invalid app id" error HOT 1
- Is this repository live? No answers from Facebook employees to many critical issues
- ANR:Input dispatching timed out (4b6b26a xxx/com.facebook.FacebookActivity (server) is not responding. Waited 5005ms for FocusEvent(hasFocus=true)) HOT 1
- There was a problem using Facebook version 12.3.0 integration login
- Log In with Patreon confirmation HOT 1
- Automatic event fb_sdk_settings_changed collects private user data
- Different performance when share the same link by web or native handler.
- Is somebody here from Facebook to solve almost 8 years old serious bug??? Your (and our) users are really angry https://github.com/facebook/facebook-android-sdk/issues/1216 HOT 1
- Use CustomTabActivity to open Fallback Feed Link to fix Embedded WebView Error HOT 1
- SDK impacted by CVE-2022-25647
- SDK should use isDebugEnabledField instead of BuildConfig.DEBUG
- Feature Request: external_id HOT 1
- Invalid Signature HOT 1
- Login for business
- Profile Pic
- Please allow indie developers to impelement Facebook Login without business verification
- Facebook SDK is not adding necessary manifest queries/intents for results from PackageManager.getActivityInfo.
- Important paper's
- SDK show WebView login instead of bring the Facebook App to share my content
- Facebook Deferred DeepLink is not working anymore
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-android-sdk.