0
votes

I am trying to connect to a facebook API, but found some issues. The user has to log in by the javascript FB.login function. Then a cookie is stored and the PHP class will try to connect with this cookie.

When I test on my local machine, everything works fine. When I upload my code to the webserver and try out my code, the connection is done with javascript. It places the cookie with the right data on my computer. When I parse the cookie, the access_token is set, but there is no way of connecting to facebook. I receive the error:

Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user

I tried to delete my cookies, so a new session is created, but I still get the same error. THe api key and secret are correct, so that cannot be the problem. I can post the code here, but it is the basic API code.

Does somebody know how I can solve this problem?

Thanks in advance!

1
does the token have enough permissions? - naveen
I only passed the publish_stream permission because that is the only one I need. The code works on localhost, but not online. I have 2 API's: 1 for localhost and 1 for the website. The endpoints and server fields are filled in correctly. The forum topic isn't related I guess. Doesn't work out for me... - VeeWee

1 Answers

0
votes

Wow... The javascript attaches some / and " chars at the beginning and the ending of the cookie. Looked over it. Was looking on this issue for about 3 hours :D

trim($cookie, '/"');

resolved my problem.