return unauthorized error when api key not found
This commit is contained in:
@@ -73,7 +73,12 @@ AuthApi.prototype.authorizedByAPIKey = function(user, req, callback) {
|
||||
return callback(err);
|
||||
}
|
||||
if ( !isValidApiKey(apikey)) {
|
||||
return callback(null, false);
|
||||
const error = new Error('Unauthorized');
|
||||
error.type = 'auth';
|
||||
error.subtype = 'api-key-not-found';
|
||||
error.http_status = 401;
|
||||
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
return callback(null, true);
|
||||
|
||||
Reference in New Issue
Block a user