Skip to content

Instantly share code, notes, and snippets.

View antonioperez's full-sized avatar

Antonio Perez antonioperez

View GitHub Profile
@antonioperez
antonioperez / node-hmac-auth.js
Created July 29, 2019 01:59
NODE JS example of creating a HTTP Authentication: MAC Access Authentication with SHA-256
/* NODE JS example of creating a HTTP Authentication: MAC Access Authentication with SHA-256
* https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-00
*/
const crypto = require('crypto');
const baseURL = 'https://example.com';
const serverId = 'SERVER-PROVIDED-ID';
const secretKey = 'SUPER-SECRET-BASE64-KEY';
const issuedKeyAt = 1557794619;
const randomString = 'WINTERBOOTS';