• Resolved rebecca009

    (@rebecca009)


    I used to use wp-json/wp/v2/users/me to retrieve json formatted info about the user. I’m unable to do that anymore?
    It says – `”code”: “rest_not_logged_in”,
    “message”: “You are not currently logged in.”,
    “data”: {
    “status”: 401
    }
    }`

    Is there another endpoint to retrieve the same user info in this plugin?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Nicu Micle

    (@nicu_m)

    Hello @rebecca009,

    You get this error, because you are not authenticated.

    You can use a JWT, in order to “act” like an authenticated user.
    Go to Simple JWT Login -> General, click on “All WordPress endpoints checks for JWT authentication” and save the settings.

    After you save the settings, you will be able to send a JWT to request, and you will be authenticated.

    Here is an example:

    
    http://localhost/wp-json/wp/v2/users/me?JWT=YOUR_JWT_HERE
    

    Also, please check this URL to find more information about how you can generate a JWT: https://docs.simplejwtlogin.com/#/?id=authenticate-user

    Hope this helps.

    PS: Please don’t forget to rate this plugin, and spread the word.

    Best regards,
    Nicu.

    Thread Starter rebecca009

    (@rebecca009)

    Hi Nicu,

    Thanks a lot. I just had to click on “All WordPress endpoints checks for JWT authentication” and save the settings.
    It works now.

    Thanks again

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

The topic ‘Retrieving user data’ is closed to new replies.