Skip to main content

Bearer Auth

The security example below was taken from the original Swagger documentation.

const doc = {
...
components: {
securitySchemes:{
bearerAuth: {
type: 'http',
scheme: 'bearer'
}
}
}
};

To see more about the properties of the doc object, see the Advanced Usage section.

At the endpoint, add the #swagger.security, for example:

app.get('/path', (req, res) => {
...
/* #swagger.security = [{
"bearerAuth": []
}] */
...
});