小编Nar*_*yaV的帖子

找不到Lexik JWT令牌

我见过类似的问题,但仍然无法使其发挥作用.

我是Symfony的新手,我正在使用Lexik JWT捆绑包和symfony3进行API身份验证,以及一个用于Web身份验证的登录表单.

我得到令牌确定,但当我尝试使用它时,我得到401 - 身份验证不良.我读过它可能是一个apache问题所以我正在尝试使用PHP的内置Web服务器,但仍然没有运气.

这是我的security.yml文件:

security:

encoders:
    AppBundle\Entity\User:
        algorithm: bcrypt

# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
    in_memory:
        memory: ~
    our_db_provider:
        entity:
            class: AppBundle:User
            property: username

firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    login:
        pattern:  ^/api/login
        stateless: true
        anonymous: true
        form_login:
            check_path:               /api/login_check
            success_handler:          lexik_jwt_authentication.handler.authentication_success
            failure_handler:          lexik_jwt_authentication.handler.authentication_failure
            require_previous_session: false
        provider: our_db_provider

    api:
        pattern:   ^/api
        stateless: true
        provider: our_db_provider
        lexik_jwt:
          authorization_header: # check token in Authorization Header
            enabled: true
            prefix: …
Run Code Online (Sandbox Code Playgroud)

php symfony jwt lexikjwtauthbundle

5
推荐指数
2
解决办法
5570
查看次数

标签 统计

jwt ×1

lexikjwtauthbundle ×1

php ×1

symfony ×1