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!
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 😀
trim($cookie, ‘/”‘);
resolved my problem.