/auth
Search
K
Comment on page

hasRole

Middleware that verifies that the token-holder has the specified roles. Returns a 403 if the user is not authorized.

Express Code

export default (app: express.Application) => {
const cors = require('cors')({ origin: true });
const middleware = new SlashauthMiddlewareExpress(slashauthClient);
app.use(cors);
app.use(express.json());
// Middleware to parse the slashauth token
app.use(middleware.parseAuthToken());
app.get(
'/',
middleware.hasRole("Member"),
wrapAsync(healthCheck)
);
}