usefulteam / jwt-auth

WordPress JSON Web Token Authentication
https://wordpress.org/plugins/jwt-auth/
124 stars 50 forks source link

Response is always HTTP status code 200 #5

Closed Zyles closed 3 years ago

Zyles commented 4 years ago

Every response, even with an error it uses the status code 200, which is incorrect by rest standards.

Should return the correct status code on errors.

contactjavas commented 4 years ago

Hi @Zyles , thanks for reporting. I will check it and get back to here

contactjavas commented 4 years ago

I haven't checked it yet, but the error responses should be 403 as described here.

Is it the error responses you're referring to @Zyles ?

Zyles commented 4 years ago

HTTP status code does not follow REST.

image

morksinaanab commented 4 years ago

@contactjavas Mohon Maaf,

I think you can solve this by passing a second parameter when instantiating WP_REST_Response() with the value of 403, wherever in your code you return this object with statusCode 403. I tried it locally in my install of your plugin and it seems to work

trims.

image
contactjavas commented 4 years ago

Hi @morksinaanab, terimakasih banyak :-) atas sarannya.

They're already implemented & pushed to master. But I can't push it yet to Wp plugin svn.

Those errors now have real 403 http status except jwt_auth_no_auth_header and jwt_bad_auth_header. There's problem when I assigned http status 403 to those two.

Btw your Indonesian language is great :)

Terimakasih!

morksinaanab commented 4 years ago

Lumayan.. After living for 9 years in Indonesia, I hope to know the language a little bit :-) Terimakasih buat fix2nya!

beshoydawood commented 4 years ago

13

cedricDevWP commented 3 years ago

The update with this correction will be available soon ?

kosso commented 3 years ago

@cedricDevWP The class-auth.php file has been updated here on github. But it appears to still be old on the Wordpress Plugins Directory when installing via Wordpress.

I just manually replaced the installed file with the one from here.

Now I get the expected HTTP Response status codes. 👍🏼

contactjavas commented 3 years ago

Hi Guys, I expect to push minor update to the plugin this week (including the fix for this).

omarkhatibco commented 3 years ago

Hi @contactjavas,

did you push the update, or not yet ?

sun commented 3 years ago

The problem is fixed in the code on GitHub, but it seems like no new release version of the jwt-auth plugin has been published yet on wordpress.org: image

It would be good if the GitHub repository would also contain the release tags. There are no tags currently. That will allow users and contributors to identify more quickly which changes are part of which release version.

contactjavas commented 3 years ago

Hey friends.. sorry for the long wait. I've been focusing on my daily work. Version 2.0.0 has just been released on GitHub and in the WordPress plugins repository. It includes a fix for this issue.

Let me close this issue. Please let me know if you encounter any issues regarding the release. Thanks