auth.getSession not working
Posted
by dC
on Stack Overflow
See other posts from Stack Overflow
or by dC
Published on 2010-03-23T09:13:30Z
Indexed on
2010/03/23
9:23 UTC
Read the original article
Hit count: 292
hi all,
i am having troubles with calling auth.getSession in my proxy.
It is being called from a iPhone connect client.
When the proxy URL is invocated from the iphone, FB returns a 100 invalid parameter error to the proxy. However the 2nd attempt from iPhone yields success. Both times the proxy is doing the same code, only the auth_token is different.
Doing a good search, shows that this is a problematic method. I have tried everything in code and even called in a iPhone expert to see if the problem is on the iPhone client.
I have concentrated my efforts on the java api being the problem, however i believe the problem lies else where.
I have done the following
- checked and tested java code
- checked and test iphone code
- checked FB application settings.
any help is most appreciated.
------Here is my java code.---------
String api_secret =
FacebookProperty.getString(FacebookConstants.PROPERTY_API_SECRET);
String api_key =
FacebookProperty.getString(FacebookConstants.PROPERTY_API_KEY);
String call_back_url =
FacebookProperty.getString(FacebookConstants.PROPERTY_CALLBACK_URL);
int connectTimeout = 200000;
//use the xml helper
// Make sure the user is logged in to Facebook
String authToken = request.getParameter("auth_token");
log.info( "FACEBOOK: auth_token?: " + authToken );
Map<String, Object> model = new HashMap<String, Object>();
model.put(FacebookConstants.MODEL_WELCOME_SELECTED, true);
FacebookXmlRestClient facebookRestClient = new FacebookXmlRestClient(api_key, api_secret);
boolean generateSessionSecret = true; //always true of connect client
try{
facebookRestClient.setConnectTimeout(connectTimeout );
String authSessionKey = facebookRestClient.auth_getSession(authToken, true);
}
catch (Exception e) {
log.log( Level.SEVERE, e.toString());
log.log( Level.SEVERE, e.getMessage());
}
String rawResponse = facebookRestClient.getRawResponse();
log.info( rawResponse );
-------the iphone code is -----------
session = [FBSession sessionForApplication:myApiKey
getSessionProxy:myURL delegate:self];
-----------the error is --------------
<error_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://
api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
<error_code>100</error_code>
<error_msg>Invalid parameter</error_msg>
<request_args list="true">
<arg>
<key>api_key</key>
<value>bf22a0512c8558a1656d73160507460b</value>
</arg>
<arg>
<key>auth_token</key>
<value>fcd1e597aca5c9ba43875cdd01221be5</value>
</arg>
<arg>
<key>call_id</key>
<value>1269066988055</value>
</arg>
<arg>
<key>format</key>
<value>xml</value>
</arg>
<arg>
<key>generate_session_secret</key>
<value>true</value>
</arg>
<arg>
<key>method</key>
<value>facebook.auth.getSession</value>
</arg>
<arg>
<key>sig</key>
<value>e9f477fd72adf74cd2de72528fd9aa72</value>
</arg>
<arg>
<key>v</key>
<value>1.0</value>
</arg>
</request_args>
</error_response>
© Stack Overflow or respective owner