Skip to content

Instantly share code, notes, and snippets.

@djpeach
Created October 3, 2019 21:54
Show Gist options
  • Save djpeach/2b98a7297b9490cfa2d8b8f8a865123d to your computer and use it in GitHub Desktop.
Save djpeach/2b98a7297b9490cfa2d8b8f8a865123d to your computer and use it in GitHub Desktop.
fixing checkAuth()
function checkAuth(req, res, next) {
if (req.headers.authtoken) {
admin.auth().verifyIdToken(req.headers.authtoken)
.then(() => {
next()
}).catch(() => {
res.status(403).send('Unauthorized')
});
} else {
res.status(403).send('Unauthorized')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment