Closed ViniMnzs closed 9 months ago
I need to setup a login request with axios as authentication method inside the express-basic-auth, to access my swagger. Is it possible? How can I do it? I tried with authorizer, but failed.
example:
app.use(['/${SWAGGER_API_PATH}'], basicAuth({ authorizer: myAuthorizer })); ` function myAuthorizer(username, password) { const response = axios.post('http://localhost:3000/api/auth', {username, password});`
app.use(['/${SWAGGER_API_PATH}'], basicAuth({ authorizer: myAuthorizer }));
`
if(response.status === 200){ return true; }; else{ return false; } };
if(response.status === 200){
return true;
};
else{
return false;
}
Check the readme on how to do asynchronous authorizers.
I need to setup a login request with axios as authentication method inside the express-basic-auth, to access my swagger. Is it possible? How can I do it? I tried with authorizer, but failed.
example:
app.use(['/${SWAGGER_API_PATH}'], basicAuth({ authorizer: myAuthorizer }));
`
function myAuthorizer(username, password) {if(response.status === 200){
return true;
};
else{
return false;
}
};