simple-jwt-login
simple-jwt-login copied to clipboard
Cannot authenticate protected APIs with JWT
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:
Login:
Authentication:
Steps to reproduce:
- Hit the Authentication api with paramters:
{
"email": "[email protected]",
"password": "password",
"AUTH_KEY": "{{PASSPORT_API_KEY}}"
}
- 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 |
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