Open apfz opened 1 year ago
maybe helpful - https://github.com/Service-Soft/lbx-jwt or try digging through these results - https://github.com/search?q=loopback%2Fauthentication-jwt+roles&type=code
@johndpope Thanks. The lbx-jwt repository is really helpful. I have replaced my code with the repository, as I couldn't quite figure out what went wrong with my implementation.
Perhaps it was an import package error. application.ts
import {JWTService} from './services/jwt.service';
Describe the bug
I am trying to access my User model's "roles" properties. I am using the @loopback/authentication-jwt package for JWT authentication.
I have tried to bind a custom JWTService with application.ts as follows:
this.bind(TokenServiceBindings.TOKEN_SERVICE).toClass(JWTService);
The custom JWT Service is as follows:
Now I decorated an endpoint in the following way:
But the JWT service never seems to get triggered.
The basicAuthorization of my decorator is as follows:
However, roles is undefined here.
How can I solve this?
Logs
No response
Additional information
No response
Reproduction
-