magesh0407 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Support fb_sig_canvas_user parameter #104

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If a user hasn't authorized the facebook app yet, Facebook sends the
"fb_sig_canvas_user" parameter to your server (instead of "fb_sig_user"). 
The latest PHP client deals with this by exposing a new get_canvas_user()
method.  It would be nice to have this in the FacebookWebappHelper class, too.

Original issue reported on code.google.com by polarys@gmail.com on 8 Sep 2008 at 7:15

GoogleCodeExporter commented 8 years ago
Also, there are several API calls that will fail because the 
FacebookWebappHelper
only initializes the FacebookRestClient with the user from fb_user and not from
fb_canvas_user.  I have fixed this with the following patch:

Index:
facebook-java-api/src/main/java/com/google/code/facebookapi/FacebookWebappHelper
.java
===================================================================
---
facebook-java-api/src/main/java/com/google/code/facebookapi/FacebookWebappHelper
.java   (revision
325)
+++
facebook-java-api/src/main/java/com/google/code/facebookapi/FacebookWebappHelper
.java   (working
copy)
@@ -74,10 +74,13 @@
        {
            // caching of session key / logged in user
            String userS = fbParams.get( FacebookParam.USER.getSignatureName() );
+           String canvasUser = fbParams.get( 
FacebookParam.CANVAS_USER.getSignatureName() );
            String sessionKey = fbParams.get( FacebookParam.SESSION_KEY.getSignatureName() );
            String expiresS = fbParams.get( FacebookParam.EXPIRES.getSignatureName() );
            if ( userS != null && sessionKey != null && expiresS != null ) {
                apiClient.setCacheSession( sessionKey, Long.parseLong( userS ), Long.parseLong(
expiresS ) );
+           } else if ( canvasUser != null ) {
+               apiClient.setCacheSession( sessionKey, Long.parseLong( canvasUser), 0L );
            }
        }
        {

Original comment by polarys@gmail.com on 23 Sep 2008 at 4:10

GoogleCodeExporter commented 8 years ago
Totally agree.  Thanks for posting this, I will also continue to post fixes for 
getting the "new profile" functionality into our library.  Eventually one day 
we 
will be totally "new profile" compliant :)

Original comment by hahna...@gmail.com on 23 Sep 2008 at 5:20

GoogleCodeExporter commented 8 years ago
fixed, svn 339. (2.0.2-SNAPSHOT)

thank you for the heads up and patch.  I also applied the change to
FacebookWebRequest, if you want to look at that class.

Original comment by fern...@gmail.com on 30 Sep 2008 at 4:10