Skip to content

Symfony 6.4 + lexik/jwt-authentication-bundle 3.0 – Missing service lexik_jwt_authentication.authenticator #1284

@developersTechroid

Description

@developersTechroid

Hi,

I’m running a PHP project with the following stack:

PHP 8.2

Symfony 6.4

lexik/jwt-authentication-bundle 3.0

When I run composer update, dependencies install fine, but during the cache clear step the process fails:

Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1

Error trace:

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 119:

The service "security.command.debug_firewall" has a dependency on a non-existent service "lexik_jwt_authentication.authenticator".

Did you mean one of these:

  • "lexik_jwt_authentication.jwt_manager"
  • "lexik_jwt_authentication.encoder"
  • "lexik_jwt_authentication.key_loader"?

What I tried

Deleted the vendor/ and var/cache/ directories manually.

Ran php bin/console cache:clear.

Same error occurs.

Current security.yaml
security:
enable_authenticator_manager: true

providers:
    user:
        id: App\Security\UserProvider

password_hashers:
    App\Entity\User:
        algorithm: bcrypt
        cost: 12

firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    # API firewall (handles /api/login and all other /api routes)
    api:
        pattern: ^/api
        stateless: true
        provider: user
        custom_authenticator: lexik_jwt_authentication.authenticator

    # Main web firewall
    main:
        lazy: true
        provider: user
        logout:
            path: /logout
            target: /

access_control:
    - { path: ^/internal_api, roles: PUBLIC_ACCESS }
    - { path: ^/api/login, roles: PUBLIC_ACCESS }
    - { path: ^/api/reset-password, roles: PUBLIC_ACCESS }
    - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }

Question:
Has lexik_jwt_authentication.authenticator been removed or renamed in v3 of the bundle? If so, what’s the correct replacement configuration for Symfony 6.4?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions