0

I'm working on an application that uses FB javascript SDK to login. On the server side, I need to do some processing, so I use the following settings:

$config = array(
              'appId' => '45....',
              'secret' => '31.....c1',
              'cookie' => true,
              'fileUpload' => false,
              'allowSignedRequest' => false);

$facebook = new Facebook($config);

So as you see, I re-login to facebook on the server side in order to use the graph API functions otherwise facebook returns an error saying that I need to have an access token to perform this operation. I'm wondering if I'm doing the right thing here ... Do i really need to login from the server side too? Or is there a way for the server to know that the user is logged in from the client side (using JS SKD) so I can perform the operations?

1 Answer 1

1

what do you meant login from server side?

When you login into an app, either is with js or php, facebook creates an token so user data can be accessed from you app so you could use js login and process data with php or other way around.

If your login is from somewhere else (eg.: mobile app) you can read the token and send it to server and them work with it, more: https://developers.facebook.com/docs/facebook-login/access-tokens/

Sign up to request clarification or add additional context in comments.

1 Comment

Well I'm wondering If I use the JS SDK to login, will I be able to use PHP SDK in the back end?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.