views:

27

answers:

1

Is it not possible to move between pages in the canvas on facebook?

I'm trying to create a app where i have two pages that the users can switch between. The first page works fine, but when i click a link on the first page to get to the next page it seems like the session is made invalid. I get:

"FacebookRestClientException' with message 'Session key invalid or no longer valid'"

Why is this? What am i doing wrong?

What i'm trying to do when i get the exception is this:

$user_details = $fb->api_client->users_getInfo($fb_user, 'last_name, first_name','hometown_location','current_location');
+1  A: 

It works fine (I do it all the time, albeit in Java).

Perhaps the second page forgets to setup the fb client correctly in the second page.

You can always look for fb_sig_session_key parameter to ensure it is being sent correctly. This is passed via POST to FBML pages and via GET to iframe canvas pages. Also, you must always refer links to http://app.facebook.com/yourcanvas/relurl for the session key to be passed.

pst
Ah I didn't refer the link to http://app.facebook.com/yourcanvas/relurlBut that will make it impossible to use ajax?
Martin
@Martin If you make your Ajax call in the iframe, remember that the iframe is really hosted on your web-server -- so use http://yourserver/youurl as the end-point. However, since this call happens OUTSIDE of the facebook 'path', you may need to pass in extra information manually (e.g. cookie or query string) as the Ajax service itself won't get the fb_sig_session_key unless you send it.
pst
Ah, got it :) Thanks.
Martin

related questions