I have a FaceBook application.
Is there any way to get signed_request with JavaScript?
With PHP it looks like this: $_REQUEST['signed_request']
, but I can't use php.
From the FB JavaScript SDK, you can use FB.getLoginStatus to retrieve the signed_request.
That is if the the user is logged into your app/website.
If not you can call the FB.login method.
Ref: http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
FOLLOWING ON TO YOUR COMMENT:
Hi,
I think you should try to log the response to your console.
The response.status should equal 'connected' if the user is logged. It will always return true, as a value will be returned in this response param.
The log will look like so
{
status: 'connected',
authResponse: {
accessToken: '...',
expiresIn:'...',
signedRequest:'...',
userID:'...'
}
}
To test what is being return try this:
if(response.status == 'connected'){
// user is logged and signed_request is accessible
// with response.authResponse.signedRequest
}else{
// user not logged in, request them to login
FB.login(function(response){ ... });
}