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
558 stars 161 forks source link

Incompatibility with wordpress 5.0 #126

Closed daniloalvess closed 5 years ago

daniloalvess commented 6 years ago

I'm testing WordPress 5.0 Beta 3 and found a incompatibility with the plugin. On editing a post, some routes return error 500:

After debugging, I think the error is on filter determine_current_user.

File: jwt-authentication-for-wp-rest-api/includes/class-jwt-auth.php on line 144

Tmeister commented 6 years ago

Thank you for the report.

I published a new version (1.2.5) to the repo, it fixes the recursion issue, but I will leave the issue open in case someone else has issues with Gutenberg.

Thanks again!

N-Molham commented 5 years ago

@Tmeister @daniloalvess

I just faced this issue and here is what I found to solve it:

if the request has the authentication cookie in the header wordpress_logged_in_* the JWT Bearer header parameter will be ignored, so make sure to make all the REST Request without that cookie, to make the JWT authentication work correctly.

I spent like an hour to figure it out after the last update for the JWT plugin

https://www.dropbox.com/s/tdcnexut9fbknnf/phpstorm64_2018-11-29_18-49-05.png?dl=0

The determine_current_user filter which parses the request header looking for the JWT token. As you can see in the screenshot, because of Gutenberg fix, it ignores it. I don't this it's the author mistake by the way

andrzejpiotrowski commented 5 years ago

@daniloalvess @N-Molham would you look at the linked PR #138 if it solves your issue? Thanks!

N-Molham commented 5 years ago

@andrzejpiotrowski thanks for notifying me