[fix] Authorization Token name in header
This commit is contained in:
parent
db9c25363a
commit
c9b7f9f024
9
index.js
9
index.js
@ -2,16 +2,17 @@
|
||||
*
|
||||
*
|
||||
2020-05-15T20:28:14.357Z
|
||||
PUT /changelog
|
||||
curl -X PUT 'http://localhost:9200/changelog' -d '
|
||||
{
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"author": { "type": "keyword" },
|
||||
"content": { "type": "text" },
|
||||
"created_at": { "type": "date","format": "basic_date_time" }
|
||||
"created_at": { "type": "date","format": "date_optional_time" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}' -H "Content-Type: application/json"
|
||||
|
||||
|
||||
*
|
||||
*/
|
||||
@ -24,7 +25,7 @@ const authorizationToken = process.env.AUTH_TOKEN || "hello";
|
||||
const port = process.env.APP_PORT || 3000;
|
||||
|
||||
function requireAuthentication( req, res, next ){
|
||||
const userAuth = req.get("authorizationToken") || req.query.authorizationToken;
|
||||
const userAuth = req.get("AuthorizationToken") || req.query.authorizationToken;
|
||||
console.log( "userAuth : "+userAuth)
|
||||
if( userAuth && userAuth === authorizationToken ) next();
|
||||
else res.end("Auth required");
|
||||
|
Loading…
Reference in New Issue
Block a user