• Resolved Earthman Media

    (@earthman100)


    When I use Postman app to try to test the endpoints that are protected by your plugin:

    First: Auth is enabled. I use that endpoint to get a token. That works fine.

    Second: I use Header: “Authorization: Bearer (that token)” to try to access api protected endpoints, as enabled in the admin ui for your plugin:

    I get error:

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

    …every time, no matter what user I use and what new token I create.

    Can you please tell me what I might be missing? Is this expected behaviour?

    Sidenote: Without a token, i get the expected result:

    
    {
        "success": false,
        "data": {
            "message": "Your are not authorized to access this endpoint.",
            "errorCode": 403,
            "type": "simple-jwt-login-route-protect"
        }
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Earthman Media

    (@earthman100)

    Is this plugin actively supported? Does my issue make sense?

    Plugin Author Nicu Micle

    (@nicu_m)

    Hello @earthman100,

    Please check the settings under “Login” -> “JWT Login Settings “, and make sure you have set “Log in by WordPress username” and also set the “JWT parameter key” with the key for the username from your JWT payload.

    Also, you can choose to log in by User ID or User email address.

    The plugin uses the Login settings when trying to find a user in a JWT.

    Please let me know if this works OK for you.

    Best regards,
    Nicu.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cannot access jwt protected api endpoints’ is closed to new replies.