[authentication] API call for anonymous requests returns error
I integrated authentication component according to instructions. Now when I'm trying to call an endpoint which doesn't have @ authentication(), it returns 500 error: Unhandled error in GET /testx: 500 Authentication metadata not found
`import {get} from '@loopback/rest';
export class UserController {
@get('/testx')
testx() {
return "anonymous";
}
}`
My packages: "dependencies": { "@ loopback/authentication": ">=4.0.0-alpha.19", "@ loopback/context": ">=4.0.0-alpha.21", "@ loopback/core": ">=4.0.0-alpha.23", "@ loopback/rest": ">=4.0.0-alpha.12", "@ types/passport": "^0.4.1", "@ types/passport-http": "^0.3.3", "passport": "^0.4.0", "passport-http": "^0.3.0" },
If you can provide a simple repo to reproduce the problem, it will help us troubleshoot the issue more effectively. Thanks.
Thanks for your reply. I just sent you an invitation to my repo. Please check out develop branch.
I'm trying to authenticate users with http header token which was simple to implement in lb3. However with lb4 I'm a bit confused.
@arash01 Hello, I can try to help with the issue here. Could you send me an invitation as well? Thanks.
I noticed that verify function in src/providers/auth-strategy.ts is empty. Could you confirm if this is the source of the problem?
@arash01 Please reference to the PR above and try the fix in it. Let us know if this fixes the problem.
Thanks, it solved the issue