-
-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering rest_authentication_errors
to true
to get jwt-auth work
#6
Comments
Great! I have the same trouble to get wp-api-jwt-auth to work. Will try this out. |
Hi, |
Same for me |
Hi, Is this still an issue, maybe this commit solves the problem https://github.com/Tmeister/wp-api-jwt-auth/pull/20/files ? |
Hi, if it can help, I'm currently using your great plugin ;-) with react, I've tried to make requests with reqwest and jquery and hadn't this issue. In my case it works with and without credentials, but with credentials true, it returns a cookie and not when it is set to false. |
@yoren where did you add this code to make it work? I am facing same issue. |
@neutronstein I put it in my |
I am having the same issue as @neutronstein. If I lock down the API with the following code I am not able to access any route under [wp-json]. add_filter( 'rest_authentication_errors', function( $result ) { I want to be able to still access [/wp-json/jwt-auth/v1/token] from an external system call passing the username/password in order to get a token to use in an Authorization header to call say [/wp-json/wp/v2/posts] However, there seems to be a missing step somewhere. Any ideas are greatly appreciated. Thanks! |
For those who find this post and need an answer to the above. This will allow access to JWT Token urls to get a token and validate once REST API locked down for all calls. Tokens then allow authenticated access when put in header for all subsequent API calls. Authorization: Bearer [token]
Cheers! |
Hey, thanks for this great plugin. I'm having an issue that I need to add:
add_filter( 'rest_authentication_errors', '__return_true' );
Which forcing WP API to skip the cookie authentication to get the JWT auth work. Or the response will always be something like 'rest_not_logged_in' (status 401).
Is it just me or it is the right way to get this plugin to work?
P.S. I'm using the latest WP API v2 beta 4 and the develop branch, both not working without adding this filter.
The text was updated successfully, but these errors were encountered: