Last active
September 7, 2018 21:09
-
-
Save brenfrow/eff6c7fa278650b919729bfdd8e0a110 to your computer and use it in GitHub Desktop.
Query params for authentication
This file contains hidden or 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
const crypto require('crypto'); | |
const ACCESS_ID = ''; | |
const SECRET_KEY = ''; | |
const EXPIRES = Math.round((new Date()).getTime() / 1000) + 60000; // 60 minutes from now | |
const signature = crypto | |
.createHmac('sha1', accessKey) | |
.update(SECRET_KEY + '\n' + EXPIRES) | |
.digest('base64'); | |
console.log(`AccessID=${accessID}&Expires=${expires}&Signature=${encodeURIComponent(signature)}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment