Symfony 4+;API Plantform+;LexikJWTAuthenticationBundle错误凭据

Symfony 4+;API Plantform+;LexikJWTAuthenticationBundle错误凭据,symfony,lexikjwtauthbundle,Symfony,Lexikjwtauthbundle,下午好。我正在symfony 4 api项目中使用LexikJWTAuthenticationBundle。我正在使用UserProvider来实现原则 在配置了用户提供者之后,我安装并配置了LexikJWTAuthenticationBundle。但当我试图在url上使用Postman来证明这个JSON{“username”:“ak”, “密码”:“ak”}我有以下错误:{ “代码”:401, “消息”:“错误凭据” }. 请参见下面的my Security.yaml配置文件。我读过论坛试图解

下午好。我正在symfony 4 api项目中使用LexikJWTAuthenticationBundle。我正在使用UserProvider来实现原则

在配置了用户提供者之后,我安装并配置了LexikJWTAuthenticationBundle。但当我试图在url上使用Postman来证明这个JSON{“username”:“ak”, “密码”:“ak”}我有以下错误:{ “代码”:401, “消息”:“错误凭据” }. 请参见下面的my Security.yaml配置文件。我读过论坛试图解决这个问题,但我还没有找到解决办法。你能帮帮我吗

security:
encoders:
    App\Entity\Utilisateur:
        algorithm: bcrypt

providers:
    #in_memory: { memory: ~ }
    our_db_provider:
        entity:
            class: App\Entity\Utilisateur

firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    login:
        pattern:  ^/api/login
        stateless: true
        anonymous: true
        json_login:
            check_path:               /api/login_check
            success_handler:          lexik_jwt_authentication.handler.authentication_success
            failure_handler:          lexik_jwt_authentication.handler.authentication_failure

    api:
        pattern:   ^/api
        stateless: true
        guard:
            authenticators:
                - lexik_jwt_authentication.jwt_token_authenticator

    main:
        pattern:    ^/
        user_checker: App\Security\UtilisateurChecker
        anonymous: true
        provider: our_db_provider         

access_control:
    - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api,       roles: IS_AUTHENTICATED_FULLY }

在测试过程中是否遗漏了一个配置?我看不到lexik的:

lexik_jwt_authentication:
    secret_key:       '%kernel.project_dir%/config/jwt/private.pem' # required for token creation
    public_key:       '%kernel.project_dir%/config/jwt/public.pem'  # required for token verification
    pass_phrase:      'your_secret_passphrase' # required for token creation, usage of an environment variable is recommended
    token_ttl:        3600

大家早上好。我找到了解决问题的办法。事实上,我输入了一个错误的用户密码

为了解决这篇文章,我使用了这篇文章 我使用本文中实现的createuser命令创建了au数据库用户

在我成功连接上一个创建的用户之后。ApiPlatform为我生成一个web目录


非常感谢您将此配置放入我的lexik_jwt_authentication.yaml文件中。lexik_jwt_身份验证:密钥:'%env(解析:jwt_密钥)%%'公钥:'%env(解析:jwt_公钥)%%'密码短语:'%env(jwt_密码短语)%'在.env文件中,我有一个#########jwt#u SECRET#KEY=%kernel.project#dir%/config/jwt/private.pem jwt#u PUBLIC#KEY=%kernel.project#dir%/config/jwt/PUBLIC.pem jwt#密码短语=5c2561dc331622e14a6ff0377bdb3cc0####