Search code examples
pythonfacebookfacebook-graph-apiaccount-kit

Python - Invalid appsecret_proof provided in the API argument Account Kit


In the Facebook docs they have mentioned that access_token consist of

AA|facebook_app_id|app_secret

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

And the appsecret_proof is hash of access token using app secret as key

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

So I am using the above generated appsecret_proof to call to the endpoint

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

with appsecret_proof as the second parameter. But still I am getting Invalid AppSecret_proof provided in API argument


Solution

  • According to the doc, you need to use an user access token and hash it with app secret to get the app secret_proof and not app access token