Comparing version 0.0.18 to 0.0.19
@@ -58,3 +58,3 @@ //Authentication setup | ||
if (settings.onAuthorized){ | ||
settings.onAuthorized(req,token); | ||
settings.onAuthorized(req, token, res); | ||
} | ||
@@ -68,5 +68,6 @@ next(); | ||
if (settings.onUnauthorized){ | ||
settings.onUnauthorized(req,token); | ||
settings.onUnauthorized(req, token, res, errorMessage); | ||
}else{ | ||
res.send({error:errorMessage}); | ||
} | ||
res.send({error:errorMessage}); | ||
}; | ||
@@ -73,0 +74,0 @@ |
{ | ||
"name": "bearer", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Bearer authentication module using token and Authorization HTTP header", | ||
@@ -5,0 +5,0 @@ "main": "bearer.js", |
@@ -7,2 +7,6 @@ BearerJS | ||
Backward compatibility remark for version 0.0.19 | ||
===== | ||
`onUnauthorized` function does not automatically send the response. You will need to handle it (see example below) | ||
Usage | ||
@@ -107,7 +111,8 @@ ===== | ||
}, | ||
onAuthorized: function(req, token){ | ||
onAuthorized: function(req, token, res){ | ||
//console.log("this will be executed if request is OK"); | ||
}, | ||
onUnauthorized: function(req, token){ | ||
onUnauthorized: function(req, token, res, errorMessage){ | ||
//console.log(req.path, "this will be executed if request fails authentication"); | ||
//res.send({error:errorMessage}); | ||
}, | ||
@@ -114,0 +119,0 @@ secureRoutes:[ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31330
136
170