Skip to content
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

Cannot authenticate protected APIs with JWT #49

Open
giricgoyal opened this issue Aug 18, 2022 · 1 comment
Open

Cannot authenticate protected APIs with JWT #49

giricgoyal opened this issue Aug 18, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@giricgoyal
Copy link

giricgoyal commented Aug 18, 2022

Bug Description

Not able to authenticate protected apis with jwt token. Receiving invald_username error. Using postman to create and test the workflow.

Configuration:
General:
general

Login:
login

Authentication:
Authentication

Steps to reproduce:

  1. Hit the Authentication api with paramters:
{
    "email": "test1@gmail.com",
    "password": "password",
    "AUTH_KEY": "{{PASSPORT_API_KEY}}"
}
  1. Hit the posts api /wp-json/wp/v2/posts with Authorization Header and JWT token received from step 1
Authorization: "Bearer <JWT TOKEN>"

Received the error:

{
    "code": "invalid_username",
    "message": "<strong>Error</strong>: Unknown username. Check again or try your email address.",
    "data": null
}

Environment

Question Answer
WordPress version 6.0.1
Simple-JWT-Login plugin version 3.4.6
@nicumicle nicumicle added the bug Something isn't working label Oct 20, 2022
@nicumicle nicumicle moved this to To do in Simple JWT Login Oct 20, 2022
@maxmadknight
Copy link

Same here
It seems like the JWT auth is triggering the "Default authentication filters"
The file wp-includes/user.php function "wp_authenticate_username_password" which throws this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do
Development

No branches or pull requests

3 participants