Created
October 3, 2019 21:54
-
-
Save djpeach/2b98a7297b9490cfa2d8b8f8a865123d to your computer and use it in GitHub Desktop.
fixing checkAuth()
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
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