Подскажите пожалуйста, как получить access_token для facebook.
Пробовал так:
import facebook
import requests
FACEBOOK_APP_ID = 'XXXXXXXXXXXXXXX'
FACEBOOK_APP_SECRET = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
""" # old version
payload = {
'grant_type': 'client_credentials',
'client_id': FACEBOOK_APP_ID,
'client_secret': FACEBOOK_APP_SECRET
}
file = requests.post('https://graph.facebook.com/oauth/access_token?', params = payload)
oauth_access_token = file.text.split("=")[1]
"""
oauth_access_token = "|".join([FACEBOOK_APP_ID, FACEBOOK_APP_SECRET])
graph = facebook.GraphAPI(access_token = oauth_access_token, version = '2.2')
groups = graph.get_object("me/groups")
group_id = groups['data'][1]['id']
graph.put_object(
group_id,
"feed",
message = instance.text,
link = instance.get_short_absoluteurl(),
picture = instance.img_url_absolute
)
Получаю в итоге oauth_access_token == "XXXXXXXXXXXXXXX|код_из_набора_символов"
А ошибка валится: An active access token must be used to query information about the current user.