Skip to content

Instantly share code, notes, and snippets.

@brenfrow
Last active September 7, 2018 21:09
Show Gist options
  • Save brenfrow/eff6c7fa278650b919729bfdd8e0a110 to your computer and use it in GitHub Desktop.
Save brenfrow/eff6c7fa278650b919729bfdd8e0a110 to your computer and use it in GitHub Desktop.
Query params for authentication
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