Iam creating symfony api (api platform) with jwt (LexikJWTAuthenticationBundle)
Login works great. I added this into security.yaml
login:
pattern: ^/api/login
stateless: true
json_login:
check_path: /api/login_check
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
Server return me token. But when I create secure source like
- { path: ^/api/notes, roles: IS_AUTHENTICATED_FULLY }
And send request with token with authorization like
Bearer --token--
Server ignore it and return "Full authentication is required to access this resource."
How can i recognize whats wrong? I spent 5 hours with it, but I dont know, what I can do.
I Run server with symfony server:start
When I created test controller like
#[Route('/test', name: 'test')]
public function index(Request $request): Response
{
$auth = $request->headers->get("Authorization");
return new Response("Authorization: ". "'".$auth."'");
}
It works, server print me token
Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJh.....'