Doing this without the facebook SDK quite simple... the key is that your facebook_app_token
is a concatenation if your app_id
and app_secret
combined with a |
.
import hmac,hashlib
facebook_app_id = '<YOUR_APP_ID>'
facebook_app_secret = '<YOUR_APP_SECRET>'
facebook_app_token = '{}|{}'.format(facebook_app_id,facebook_app_secret)
app_secret_proof = hmac.new(facebook_app_secret.encode('utf-8'),
msg=facebook_app_token.encode('utf-8'),
digestmod=hashlib.sha256).hexdigest()
Then you can include the app_secret_proof in whatever API you're calling... e.g.,
import requests
base_url = 'https://graph.facebook.com/v2.10/<USER_ID>/ids_for_pages?access_token={}&appsecret_proof={}'
url = base_url.format(facebook_app_token,app_secret_proof)
result = requests.get(url)
result.json()
status = api.put_wall_post(msg, postargs)
with:status = api.put_wall_post(msg, appsecret_proof=genAppSecretProof(access_token))
– Antimissile