i want to get information from my API protected by access_control, my user is logged and i still have the error "Full authentication is required to access this resource." Even when i pass my Bearer token through the header.
there is no Apache htaccess or Encrypted key like i found here
from the /docs interface and from my front-end, my requests are likes
Here is my api/config/packages/security.yaml
security:
# https://symfony.com/doc/current/security.html#c-hashing-passwords
password_hashers:
App\Entity\User: 'auto'
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
# used to reload user from session & other features (e.g. switch_user)
users:
entity:
class: App\Entity\User
property: email
firewalls:
dev:
pattern: ^/_(profiler|wdt)
security: false
api:
pattern: ^/api/
stateless: true
provider: users
jwt: ~
main:
json_login:
check_path: /auth # The name in routes.yaml is enough for mapping
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
access_control:
- { path: ^/$, roles: PUBLIC_ACCESS } # Allows accessing the Swagger UI
- { path: ^/docs, roles: PUBLIC_ACCESS } # Allows accessing API documentations and Swagger UI docs
- { path: ^/auth, roles: PUBLIC_ACCESS }
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }
Here is my api/config/packages/api_platform.yaml
api_platform:
title: Hello API Platform
version: 1.0.0
# Mercure integration, remove if unwanted
mercure: ~
formats:
jsonld: ['application/ld+json']
docs_formats:
jsonld: ['application/ld+json']
jsonopenapi: ['application/vnd.openapi+json']
html: ['text/html']
# Good defaults for REST APIs
defaults:
stateless: true
cache_headers:
vary: ['Content-Type', 'Authorization', 'Origin']
extra_properties:
standard_put: true
rfc_7807_compliant_errors: true
event_listeners_backward_compatibility_layer: false
keep_legacy_inflector: false
swagger:
api_keys:
JWT:
name: Authorization
type: header
When i followed the tutorial i had an error at this command generating key command
screen from error putting acl on docker volume
is it possible that my error come from here ? and i didn't find how to fix it