Skip to content

Instantly share code, notes, and snippets.

@materkel
Last active September 7, 2021 11:27
Show Gist options
  • Save materkel/8ee313da4ceb5b301b2ac3fc9ace547a to your computer and use it in GitHub Desktop.
Save materkel/8ee313da4ceb5b301b2ac3fc9ace547a to your computer and use it in GitHub Desktop.
create facebook appsecret proof in NodeJS
const crypto = require('crypto');
let accessToken = 'your fb accesstoken' || 'facebookClientId' + '|' + 'facebookClientSecret'
let clientSecret = 'your fb client secret'
let appsecret_proof: crypto.createHmac('sha256', clientSecret).update(accessToken).digest('hex')
@gijo-varghese
Copy link

@jyotman it's not working for me. What about you?

@jmcombs
Copy link

jmcombs commented Apr 23, 2019

I created a Gist for this as well. fb_appsecret_proof.js. @mfressdorf and @peterpeterparker's code works, maybe my take will help others. When I reference accessToken in my Gist, keep in mind, this is the access token used when making Graph API calls for your Facebook App on behalf of the user using the App so, it would typically be the long term access token that you generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment