Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

assertBearerToken

This val can be used to assert that a valid bearer token exists and has been signed by the secret provided.

Example

const handler = (req, res) => { const authorization = req.get('authorization'); // throws if invalid const token = @neverstew.assertBearerToken(@me.secrets.superSecret, authorization); res.json(token); }