Created
May 9, 2022 16:57
-
-
Save panreel/df0d7a6c8d892291cc255ae2283a6fa4 to your computer and use it in GitHub Desktop.
Python code to generate appsecret_proof and appsecret_time need to call Workplace API with appsecret_proof configured: https://developers.facebook.com/docs/workplace/reference/permissions/#appsecretproof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hmac | |
import hashlib | |
import time | |
access_token = 'access_token' | |
app_secret = 'app_secret' | |
time = int(time.time()) | |
hmac_secret = app_secret.encode() | |
hmac_data = (access_token+'|'+str(time)).encode() | |
app_secret_proof=hmac.new(hmac_secret,hmac_data,hashlib.sha256).hexdigest() | |
print('Time:', time) | |
print('Data:', hmac_data) | |
print('Secret:', hmac_secret) | |
print('App Secret Proof:', app_secret_proof) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment