I’ve created an custom api endpoint and everything appears to be up and working as expected atm when I set the route config: {auth: false}
. However, when attempting to secure the route I’m getting a 401.
routes: test-auth-api.js
module.exports = {
routes: [
{
method: 'GET',
path: '/test-auth-api',
handler: 'test-auth-api.exampleAction',
config: {
// auth: false,
auth: {
strategies: ["jwt"],
},
policies: [],
middlewares: [],
},
},
],
};
controllers: test-auth-api.js
module.exports = {
exampleAction: async (ctx, next) => {
try {
ctx.body = 'ok';
} catch (err) {
ctx.body = err;
}
}
};
I’ve made sure to also allow the role access to this endpoint as well.
What might I be doing wrong or not have set in order for me to secure this down to the role that the user is logged in as?