• Hi,

    I am creating a new user via API using Application Password. And I use JWT plugin once the user is logged in. Can you provide a filter where we can add few endpoints that needs not to be validated for correct jwt token?

    Right now it validates each and evry endpoint and displays an error jwt_auth_bad_auth_header when it does not find bearer token,

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • salih24by7

    (@salih24by7)

    @imani3011 Have you got any solution for this?

    for a quick solution – you can add “token/validate” to your request path or in a query string argument, and that will cause jwt bypass the token verification. For eg: https://example.com/wp-json/v1/callback?path=token/validate

    The above solution will work, but I dont know this is a proper way or not? I dont see any filters to do this in the codebase too.

    In the Plugin Changelog – Version 1.3.0 they are talking about this: Allow for Basic Auth, by not attempting to validate Authentication Headers if a valid user has already been determined (see: https://github.com/Tmeister/wp-api-jwt-auth/issues/241)

    I dont know if they are referring to the same issue, if it is, that is not working. I can see there is no reply for almost all support questions here, so not expecting much.

    Thank you so much @salih24by7! Your comment helped me out on how to dismiss errors when accessing public endpoints when you have the JWT Authentication for WP REST API plugin active. Thanks! 😄

    Error:
    Warning: Undefined array key “HTTP_AUTHORIZATION” in \app\public\wp-content\plugins\jwt-authentication-for-wp-rest-api\public\class-jwt-auth-public.php on line 222

    Warning: Undefined array key “REDIRECT_HTTP_AUTHORIZATION” in \app\public\wp-content\plugins\jwt-authentication-for-wp-rest-api\public\class-jwt-auth-public.php on line 225

    @artneo Glad to here that 🙂

    Trying to disable the JWT plugin for some endpoints as well. Surprised there isn’t a filter for this. Thanks for the workaround @salih24by7 !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filter few endpoints to not use JWT token’ is closed to new replies.