wordpress api with JWT Authentication for WP-API

talhabutt111

talhabutt111

Posted on December 12, 2019

wordpress api with JWT Authentication for WP-API

Hello i want implementing wordpress rest api in my nodejs express app.i am using JWT Authentication for WP-API plug in .but i cant not get all users from myapi call. following error i am facing when a call the route:

{code:"rest_no_route"data:Object {status: 404}message:"No route was found matching the URL and request method",}

Code for my rest wp route is following:

var WPAPI = require('wpapi'); var wp = new WPAPI({ endpoint: 'domain.com/wp-json' }); wp.myCustomResource = wp.registerRoute('jwt-auth/v1', '/token',
{ methods: 'POST', params: ['username', 'password'] })
wp.myCustomResource()
.username('myUserName').password('myPassword')
.then(res => console.log(res))
.catch(err => console.error(err))
});

i have already generate token and validate it from postman. i code it from this site "http://wp-api.org/node-wpapi/custom-routes/"

i already edit my .htaccess file and my plugin file( jwt-authentication-for-wp-rest-api/public/class-jwt-auth-public.php) but it does not helped me.

if some one resolve this error kindly help us

💖 💪 🙅 🚩
talhabutt111
talhabutt111

Posted on December 12, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related