You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
I am trying to process token and send a response back if the token is not present. I am trying to follow the document here
The issue is that in the auth code, I am unable to access req.res object to overload the response.
// Line 15 on verifyToken code in the link above
function sendError() {
return req.res.status(403).json({message: 'Error: Access Denied'});
}
Here is how I am initializing the middleware.
// Initialize the Swagger middleware
swaggerTools.initializeMiddleware(swaggerDoc, function (middleware) {
// Route validated requests to appropriate controller
app.use(middleware.swaggerRouter(options));
// Serve the Swagger documents and Swagger UI
app.use(middleware.swaggerUi());
// Interpret Swagger resources and attach metadata to request - must be first in swagger-tools middleware chain
app.use(middleware.swaggerMetadata());
// Validate Swagger requests
app.use(middleware.swaggerValidator());
// Use security
app.use(middleware.swaggerSecurity({
Bearer: auth.verifyToken
}));
Appreciate any pointers.
S
The text was updated successfully, but these errors were encountered:
Lastly, if the response is just not there for you to work with (i.e. couldn't find res.status), I just composed a new response using a util tool I have and returned that.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
I am trying to process token and send a response back if the token is not present. I am trying to follow the document here
The issue is that in the auth code, I am unable to access req.res object to overload the response.
Here is how I am initializing the middleware.
Appreciate any pointers.
The text was updated successfully, but these errors were encountered: