Created
January 12, 2018 16:36
-
-
Save simonr-cb/069f5a5477b782a15dab779a25a162d8 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
// Verify and decode the Approov token and respond with 403 if the JWT | |
// could not be decoded, has expired, or has an invalid signature | |
const checkApproovTokenJWT = jwt({ | |
secret: new Buffer(config.approovTokenSecret, 'base64'), | |
getToken: function fromApproovTokenHeader(req) { | |
// Retrieve the Approov token used to authenticate the mobile app from the request header | |
var approovToken = req.get('Approov-Token') | |
if (!approovToken) { | |
console.log('\tApproov token not specified or in the wrong format') | |
} | |
return approovToken | |
}, | |
algorithms: ['HS256'] | |
}) | |
router.use(checkApproovTokenJWT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment