Last active
March 17, 2023 07:09
-
-
Save optlsnd/95ab117e2c022be633b452a4728889fa to your computer and use it in GitHub Desktop.
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
// Imports | |
const EdgeAuth = require("akamai-edgeauth"); | |
// Configuration | |
const encryptionKey = | |
"73636b61519adede42191efe1e73f02a67c7b692e3765f90c250c230be095211"; | |
const host = "sectest.ucarecdn.com"; | |
const path = "/06933f0d-5f31-425d-a5b8-6c5c2cdaaae6/-/resize/600x/"; | |
const duration = 3200; | |
// Generate token | |
const edgeAuth = new EdgeAuth({ | |
key: encryptionKey, | |
windowSeconds: duration, | |
tokenName: "token", | |
escapeEarly: true, | |
}); | |
const token = edgeAuth.generateACLToken(path); | |
const signedURL = `https://${host}${path}?${edgeAuth.options.tokenName}=${token}`; | |
console.log("Signed URL: ", signedURL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using wildcards: