Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create a signed JWT from the given configuration

Tags:

php

symfony

Hello I'm coding a symfony API for my hackathon event this is my first time using api in symfony but it's still returning this annoying error i passed the true values but this error steal hitting me UPP anyway m following this dude tuto can someone help a brother out i lost my 8h in this and i could'n find a way :'((( requires
symfony 5 php 7 api platform

this is my security.yml

security:
    encoders:
        App\Entity\User:
            algorithm: auto

    providers:
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        login:
            pattern: ^/api/login
            stateless: true
            anonymous: true
            json_login:
                check_path: /api/login
                username_path: email
                password_path: password
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure
        api:
            pattern: ^/api/
            stateless: true
            anonymous: true
            provider: app_user_provider
            guard:
                authenticators:
                    - lexik_jwt_authentication.jwt_token_authenticator
        main:
            anonymous: lazy
            provider: app_user_provider

    access_control:
        - { path: ^/api/docs, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Allows accessing the Swagger UI
        - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/users, roles: IS_AUTHENTICATED_FULLY }


this is my rootes.yml

authentication_token: path: /api/login methods: ['POST']

and this is my postman request enter image description here

i tried to re-generate my token file with $ openssl genrsa -out config/jwt/private.pem -aes256 4096 $ openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem and nothing happened. A functional login root, that's all I want for Christmas thanks

like image 698
saad jlassi Avatar asked Oct 29 '25 21:10

saad jlassi


1 Answers

Try generating SSL keys

php bin/console lexik:jwt:generate-keypair

src: Lexik JWT docs

like image 164
TheToster Avatar answered Oct 31 '25 12:10

TheToster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!