Created
June 3, 2019 21:59
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
var config = { | |
appRoot: __dirname, // required config | |
// Security Handlers | |
swaggerSecurityHandlers: { | |
apiKeyAuth: function(req, authOrSecDef, scopesOrApiKey, cb) { | |
var apiKey = req.headers['x-api-key']; // Values get simplified here. | |
console.log(req.headers); | |
console.log(apiKey); | |
if (apiKey) { | |
if(apiKey == app.get("API_KEY")) { | |
cb(); | |
} else{ | |
cb(new Error('authentication failed')); | |
} | |
} else { | |
cb(new Error('authentication failed')); | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment