• JWT Authentication for WP-API – Version 1.2.0
      WordPress – Version 4.6.1

    I can retrieve the token value.
    I can put the Authorization in the Request header.
    I can not get the plugin to actually authorize anything.

    I read one post on this support forum asking for 4.5 WordPress support. Has this plugin been broken since then ?

    Problem details:

    When I try the validate endpoint (https://localhost:82/wp-json/jwt-auth/v1/token/validate on my local machine) I get the 403 jwt_auth_no_auth_header error message. (I did this with a post, using angular JS – i.e. $http.post(jwtValidateURL).then…)

    Note:

    Here is the Authorization value in the Request header for the validate URL which returned the 403 (via Chromes Network tab in their Developer tools console)

    POST /WordPress/wp-json/jwt-auth/v1/token/validate HTTP/1.1
    Host: localhost:82
    Connection: keep-alive
    Content-Length: 0
    Accept: application/json, text/plain, */*
    Origin: https://localhost:82
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODJcL1dvcmRQcmVzcyIsImlhdCI6MTQ3NjEwOTUwNiwibmJmIjoxNDc2MTA5NTA2LCJleHAiOjE0NzY3MTQzMDYsImRhdGEiOnsidXNlciI6eyJpZCI6IjEifX19._UwgONVA2KiypV4ePGXyrgYr0sz3Vgrq67X3mH-RdGk
    Referer: https://localhost:82/WordPress/login/
    Accept-Encoding: gzip, deflate
    Accept-Language: en-US,en;q=0.8
    .
    .
    .

Viewing 1 replies (of 1 total)
  • Thread Starter sslaughter

    (@sslaughter)

    Semi Update/Hack for this.

    The Validate endpoint was successful in our PRO environment (my local must have not had all the permissions set correctly in .httaccss), but when I tried to retrieve user information (using WP API v2) I would get an error message saying I had not logged in yet. Acting like the Auth was not being passed along to WP API v2

    I saw this on the wp-api-jwt-auth plugins github “issues” page:
    https://github.com/Tmeister/wp-api-jwt-auth/issues/6

    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.

    After putting add_filter( ‘rest_authentication_errors’, ‘__return_true’ ); to my themes functions.php I can retrieve the user info – but there looks like some weird redirection is going on – but that is more of a WP API V2 issue than it is wp-api-jwt-auth’s

Viewing 1 replies (of 1 total)
  • The topic ‘Will not Authorize. Does Plugin work in WordPress 4.6 ?’ is closed to new replies.