• Hey! I am working on a SSO between ASP and WP. I was told to use JWT. We found this plugin but I cannot get it working correctly.

    I have the endpoints showing up but I get a ‘password is empty’ when I use Postman to test it, and I see a “rest no route” message when I visit the endpoints.

    Is there an actual thorough tutorial with proper documentation on this plugin anywhere? Can anyone tell me about the issues above?

    Thanks so much guys, I am on a tight deadline, this thing is killing me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jasonbrogdon

    (@jasonbrogdon)

    I resolved this issue.

    1. Double-check your .htaccess file. Mine looked like this:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /yoursitename/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /yoursitename/index.php [L]

    RewriteEngine on
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule ^(.*) – [E=HTTP_AUTHORIZATION:%1]
    </IfModule>

    # END WordPress

    2. Then you will need to make sure you have custom names selected on permalinks. At least in my case this helped.

    3. The endpoint is actually gonna be /wp-json/jt-auth/v1/token
    4. Test requests to /wp-json/wp/v2/posts/Request String Here……. See WP REST API Docs

    TESTING FOR TOKEN

    You can make your life a lot easier installing OAuth Server v2. Create a Client with a Client ID and Secret. Copy them. Follow this using the Postman testing tool.

    ESTING THE JWT AUTHENTICATION PLUGIN FOR WP REST API v2 in POSTMAN
    (assumes you have generated a client id and secret key using the 0Auth Server v2 plugin)

    1. ENTER THE URL:
    https://yoursitename/wp-json/jwt-auth/v1/token

    2. Set to POST

    3. Set type to “Basic Auth”

    4. Set Username to “Client ID from OAuth Server Plugin”

    5. Set Password to “Secret from OAuth Server Plugin”

    6. Update Request

    7. Set body to x-www-form-urlencoded

    8. add key “grant_type” value “password”

    9. add key “username” value “Legit WordPress Username”

    10. add key “password” username “Legit WordPress Password”

    11. Hit Send

    JSON RESPONCE SAMPLE:
    {
    “token”: “AbunchoflettersandnumbersherelikeX9e9we9eWEw#WrS”,
    “user_email”: “[email protected]”,
    “user_nicename”: “wordpressuser”,
    “user_display_name”: “wordpressuser”
    }

    URL TEST
    https://yoursitename/wp-json/wp/v2/users/1?access_token={The token from the response above goes here}

    Ok. I hope that helps you get this far. This is where I am in my project. Good luck!

    Thread Starter jasonbrogdon

    (@jasonbrogdon)

    I am going to add to this. One of the issues I ran into was an “Authorization header not found” issue. I used shared hosting on my dev environment but that was not the problem. The issue was the placement of the code withing the .htaccess file.

    Place it at the top!

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule ^(.*) – [E=HTTP_AUTHORIZATION:%1]
    ABOVE HERE IS FINE…REMOVE THIS IF YOU COPY
    RewriteBase /yoursitename/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /yoursitename/index.php [L]
    </IfModule>

    This resolved my issue and I received a status 200 OK. Very happily too ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘REST NO ROUTE, PASSWORD EMPTY’ is closed to new replies.