-
-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"code": 401, "message": "Invalid credentials." while passing the jwt #906
Comments
Maybe something wrong with your Is it ok to have How about change to the following config and try again? https://github.com/lexik/LexikJWTAuthenticationBundle/blob/2.x/Resources/doc/index.md#configuration |
Hey, sorry for the close/reopen, that's a misclick. |
Are you using Bearer Token header? Cause i see you only have If you using apache, you might need to check this out https://github.com/lexik/LexikJWTAuthenticationBundle/blob/2.x/Resources/doc/index.md#important-note-for-apache-users |
I also noticed that the header in the Ui is not correct, so I always used Insomnia to set the header to authorzation bearer. I'm using the symfony server (PHP Server), so this should actually work |
So it works now? Did you manage to find the source of the issue? |
No unfortunately it still does not work and I still do not know why. No idea, maybe it's because of the php server |
Have you try this if your server are using apache? You may I'm not sure if we can set it at .htaccess instead though. |
To use the Symfony Apache-Pack doesn't seam to work either. I'll try to set up an Apache now and then try this again |
Having absolutely the same issue. Used docker-compose config from api platform. Followed all their instructions from here. After passing correct creds i get token, but when I try make request with it i get 401 error. Checked token on jwt.io. It says everything is correct and signature is valid. UPD. I think I faced the reason. providers:
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
property: email So user not found. UPD2. I guess I've solved the problem # api/config/packages/lexik_jwt_authentication.yaml
lexik_jwt_authentication:
....
user_identity_field: email solved the issue |
What's the status of your progress? Did you manage successfully to authenticate? |
Unfortunately I could not try anything else yet due to time constraints. But I will try out the suggested solutuion soon |
And also like @furang suggested, do remember to check your user identify that are use for authenticate. |
Seems like the issue is solved as per #906 (comment). |
Thank you man ! It solved my issue, it should be automatic |
Hey,
I'm currently trying to implement the JWT Authentication Bundle in my API Platform Project.
Everything has worked well so far, except that I'm unable to access my resources with a generated JWT Token.
I'm able to generate a JWT Token, when passing a username and a password to the backend.
But as soon as I'm trying to use this token I receive this 401 error.
The request is passed with http to the backend on my localhost, I also tried https.
I manually validated the jwt on jwt.io and everything seems to be fine with the token.
The API Platform project runs in a docker container.
If you need some further information, just let me know
Operating System: Mac OS
My security.yml
api-platform.yml
Lexikon_jwt_authentication.yml
JwtDecorator.php
The text was updated successfully, but these errors were encountered: