chalasr/lexik-jwt-authentication-sandbox

Unable to create a signed JWT from the given configuration.

Sluimers opened this issue · 0 comments

I have followed the Readme and tried curl -X POST -H "Content-Type: application/json" http://localhost:8000/login_check -d '{"username":"johndoe","password":"test"}' after registering.

I had to slightly alter doctrine.yaml to the type of driver my project uses.

doctrine.yaml

parameters:
    # Adds a fallback DATABASE_URL if the env var is not set.
    # This allows you to run cache:warmup even if your
    # environment variables are not available yet.
    # You should not need to change this value.
    env(DATABASE_URL): 'sqlsrv://db_user:db_password@127.0.0.1:1433/db_name'

doctrine:
    dbal:
        default_connection:   default
        connections:
            default:
                driver: sqlsrv
                dbname: LUNCH_QR_LEXIK_TEST
                host: LTxxxx\SQLEXPRESS
                port: ~
                user: QR_Lunch
                password: xxx
    orm:
        auto_generate_proxy_classes: '%kernel.debug%'
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
        mappings:
            App:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'App\Entity'
                alias: App

This is the error I get:

JWTEncodeFailureException
in vendor\lexik\jwt-authentication-bundle\Encoder\LcobucciJWTEncoder.php (line 41)
throw new JWTEncodeFailureException(JWTEncodeFailureException::UNSIGNED_TOKEN, 'Unable to create a signed JWT from the given configuration.');

Uncaught PHP Exception Lexik\Bundle\JWTAuthenticationBundle\Exception\JWTEncodeFailureException: "Unable to create a signed JWT from the given configuration." at C:\Linux\Cygwin\home\rsluimers\PhpstormProjects\LunchApp\lexik-jwt-authentication-sandbox\vendor\lexik\jwt-authentication-bundle\Encoder\LcobucciJWTEncoder.php line 41