2016-12-01 27 views
1

在這種ACCESS_TOKEN由Python的 - 在API參數帳戶套件

AA的,他們都提到了Facebook的文檔提供無效appsecret_proof | facebook_app_id | app_secret

https://developers.facebook.com/docs/accountkit/graphapi

而且appsecret_proof是訪問的散列令牌使用的應用程序的祕密關鍵

appsecret_proof = hmac.new((app_secret).encode('ascii'), msg=access_token.encode('ascii'), digestmod=hashlib.sha256).hexdigest()

小號ø我使用上述生成的appsecret_proof調用到端點

https://graph.accountkit.com/v1.1/me/?access_token=

與appsecret_proof作爲第二個參數。不過還是我越來越無效AppSecret_proof在API參數

回答

1

提供了根據文檔,你需要使用一個用戶訪問令牌與應用程序的祕密散列它得到應用secret_proof,而不是應用程序訪問令牌

0

你app_token似乎是不正確,語法是<app_id>|<app_secret> - 如:

facebook_app_id  = '<YOUR_APP_ID>' 
facebook_app_secret = '<YOUR_APP_SECRET>' 
facebook_app_token = '{}|{}'.format(facebook_app_id,facebook_app_secret) 

然後,您可以生成appsecret_proof如下:

import hmac,hashlib 
app_secret_proof = hmac.new(facebook_app_secret.encode('utf-8'), 
          msg=facebook_app_token.encode('utf-8'), 
          digestmod=hashlib.sha256).hexdigest()