{"id":405583,"date":"2024-07-30T08:00:00","date_gmt":"2024-07-30T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/require-auth-users-rest-endpoint\/"},"modified":"2025-04-17T05:12:00","modified_gmt":"2025-04-17T05:12:00","slug":"require-auth-users-rest-endpoint","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/require-auth-users-rest-endpoint\/","title":{"rendered":"Require Auth Users REST Endpoint"},"content":{"rendered":"<p>This plugin modifies the <code>\/wp-json\/wp\/v2\/users<\/code> endpoint to require authentication.<\/p>\n<p>By default on a WordPress site you can list the users that have posted content on the site by visiting this endpoint.<\/p>\n<p>This plugin requires the user to be authenticated to view the list of users.<\/p>\n<h3>What this means<\/h3>\n<p>If you go directly to the URL <code>\/wp-json\/wp\/v2\/users<\/code> you will get a <code>401 Unauthorized<\/code> response.<\/p>\n<p>But if you open a block editor page and run the following from the browser console,<\/p>\n<pre><code>await wp.apiFetch({path: 'wp\/v2\/users'});\n<\/code><\/pre>\n<p>you will get a list of users (because the <code>wp.apiFetch()<\/code> function authenticates the user\u2019s call to the WordPress REST API).<\/p>\n<h3>Author<\/h3>\n<p>Sal Ferrarello \/ <a href=\"https:\/\/salferrarello.com\" rel=\"nofollow ugc\">salferrarello.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Require authentication when accessing the \/wp-json\/wp\/v2\/users REST API endpoint.<\/p>\n","protected":false},"author":65,"featured_media":405584,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Require Auth Users REST Endpoint - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Require authentication when accessing the \/wp-json\/wp\/v2\/users REST API endpoint."},"footnotes":""},"categories":[1],"tags":[461,180,3472,1473,1628],"class_list":["post-405583","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-api","tag-authentication","tag-endpoint","tag-rest","tag-users"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/405583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=405583"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/405583\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/405584"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=405583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=405583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=405583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}