Facebook's "signed_request" is empty when first starting app
I had to add Facebook Credits to my app, in order to do that I had to activate "OAuth 2.0 for Canvas", which is supposed to send a signed_request to my app
But I noticed that when I first start the app af开发者_如何学JAVAter not using it for a while (or in a different browser), signed_request is empty. If I reload the page, then its there. But the first time, its always empty. I use $_REQUEST['signed_request'] to get it.
My guess is that this has to be somehow related with cookies or session expiring.
Any ideas?
On your app settings, be sure to put trailing slash - "/" on your app path (or tab URL). Leave other settings to their default values.
Answer: signed_request WAS being sent when opening the app. But then require_login() was causing a page reload (not always, but sometimes) and then signed_request was being lost, causing the illusion that signed_request was not being sent at all.
Solution: I replaced all REST api calls with GRAPH api calls.
Hope this information is useful to someone!
精彩评论