1

I just installed and configured the LexikJWTAuthenticationBundle as the provided example shows for.

But when I try to generate a token

with

curl -X POST http://localhost:8000/api/login_check -d _username=johndoe -d _password=test

I use my correct user and password

I get:

{"error":{"code":500,"message":"Internal Server Error","exception":[{"message":"Failed to load private key \"\/home\/web\/symfony\/app\/var\/jwt\/private.pem\". Did you correctly configure the corresponding passphrase?

How do I debug this error?

2
  • 2
    What you want to debug if everything that you need to know is in the error message? When you created key you set passphrase, and now you should set it in bundle config pass_phrase or generate keys without passphrase. Commented Sep 5, 2016 at 20:22
  • oopsy! thanks a lot!! Commented Sep 6, 2016 at 7:15

1 Answer 1

1

Please set provider first in app/config/security.yml file like below:-

providers:
        in_memory:
            memory:
                users: 
                    johndoe:
                        password: test
                        roles: 'ROLE_USER'

After above setting, you can run below command, after running below command you will get token, use that token for your request:

 curl -X POST http://localhost:8000/api/login_check -d _username=johndoe -d _password=test

For more about setting, please refer below link:- enter link description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.