-2

I trying to get a facebook cover by run

curl https://graph.facebook.com/me/?fields=cover?access_token=*****

In my terminal - I kept getting

An active access token must be used to query information about the current user.

Any hints will be appreciated !

code-8
  • 54,650
  • 106
  • 352
  • 604
  • The access token must be valid. But it is good that it isn't. Because it would be stupid to post an active access token here – WizKid Jan 14 '16 at 23:16
  • 1
    that token even includes publish_actions. check out your wall ;) - and don´t just remove it from here, because there is an edit history. you need to invalidate it by removing the app in the settings. – andyrandy Jan 14 '16 at 23:17
  • Thanks for tip. I didn't know that it is sensitive. – code-8 Jan 14 '16 at 23:18

1 Answers1

4

This would be correct, the Access Token was valid but you wrote "?" instead of "&" for the second parameter:

https://graph.facebook.com/me/?fields=cover&access_token=*****

Btw, you can check if your Token is valid in the Debugger: https://developers.facebook.com/tools/debug/

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • I deleted my token. Went through the whole permission again. Redid as you suggested. I got the same error. What else could it be ? – code-8 Jan 14 '16 at 23:22
  • Do I missed any permission ? – code-8 Jan 14 '16 at 23:34
  • you should not need any additional permissions, check out the additional info in my answer. it should actually work even if you just enter the link in the browser, with a valid token. – andyrandy Jan 14 '16 at 23:58
  • I just check. It's a valid token. Also, when I tried within the Graph Tool Explorer it work, but when I tried cURL in my terminal. It doesn't work. :( – code-8 Jan 15 '16 at 00:00
  • If you run curl with that url and your token instead - will it work ? – code-8 Jan 15 '16 at 00:06
  • i can even just put that url in the browser and it works, so it will definitely work with curl. you should debug curl: http://stackoverflow.com/questions/3757071/php-debugging-curl - it would also be a good idea to include your code in your question. – andyrandy Jan 15 '16 at 08:31
  • shell_exec? you should not do that. > php.net/manual/book.curl.php – andyrandy Jan 15 '16 at 14:00
  • Dude, you're right. I updated my function to use cURL rather than shell exec. Now it works like a charm :) – code-8 Jan 15 '16 at 14:12
  • 1
    Thanks for your enthusiasm for help ! – code-8 Jan 15 '16 at 14:14