1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

Use capital letter in Bearer as per rfc spec

This commit is contained in:
Vishal Banthia 2015-12-18 16:00:24 +09:00
parent b1f7f67eb7
commit 484e56be12
2 changed files with 15 additions and 13 deletions

View file

@ -9,16 +9,18 @@ module.exports = {
accessTokenAuth: accessTokenAuth
}
// Specifications: https://tools.ietf.org/html/rfc6750#section-2.1
function accessTokenAuth(req, res, next) {
if (req.headers.authorization) {
var authHeader = req.headers.authorization.split(' ')
, format = authHeader[0]
, tokenId = authHeader[1]
if (format !== 'bearer') {
if (format !== 'Bearer') {
return res.status(401).json({
success: false
, description: 'Authorization header should be in "bearer $AUTH_TOKEN" format'
, description: 'Authorization header should be in "Bearer $AUTH_TOKEN" format'
})
}