Tmeister / wp-api-jwt-auth

A simple plugin to add JSON Web Token (JWT) Authentication to WP REST API
GNU General Public License v2.0
556 stars 160 forks source link

Returning 0 when calling determine_current_user() #257

Open marioshtika opened 1 year ago

marioshtika commented 1 year ago

Hello @Tmeister,

I am having a problem when using your plugin with the BuddyPress plugin. Specifically with the Messages endpoint. I am getting the below error:

{
    "code": "bp_rest_authorization_required",
    "message": "Sorry, you cannot view the messages.",
    "data": {
        "status": 403
    }
}

This error message means that the user does not exist.

I followed the logic and I found out that the determine_current_user() is returning the user even though it shouldn't.

So I created a pull request #256 and tried to fix the if condition to return the user only if it's a REST request and the user exists.

I tested my PR and it is working fine.

Let me know if you need me to do any more tests or anything at all.

Thank you in advance

marioshtika commented 1 year ago

Hello @Tmeister,

any update on this?

marioshtika commented 1 year ago

Hello @Tmeister

did you have time to review my pull request #256.

I know a lot of users that are having the same problem.

Thank you in advance

marioshtika commented 1 year ago

Hello @Tmeister,

any update on this issue?

Thank you in advance.

marioshtika commented 1 year ago

Also, this is not related only to the BuddyPress plugin anymore, it is also happening on the default post API.

marioshtika commented 1 year ago

@Tmeister any update on this, this is happening more and more often, on different websites.