From the course: WordPress: REST API

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Test JWT authentication via REST client

Test JWT authentication via REST client - WordPress Tutorial

From the course: WordPress: REST API

Test JWT authentication via REST client

- [Instructor] Let's see if we can use JWT to authenticate a request to edit an existing post. To do this, I first need to find a post to edit. So I'll open the posts routes and just send a get request to get all my posts. Then I'll target the post with ID one. And here I'm going to copy the URL and then add it into a new tab so I don't accidentally overwrite anything in my collection, there, then say get post ID one. This gives me just that one post. And this is the post I want to edit. So here I want to edit the title. Now, you remember from a previous example, that to edit the title, I send a POST request. And then in the body, I go to raw JSON, and pass a JSON object with whatever I want to change, in my case, title. And I want to change the title to new title sent through authenticated requests. Now of course, if I send this request right now, I'll get a 401 unauthorized error, I can try it, see? 401…

Contents