This is how I did it, but I feel it could be better. For one thing, this results in HTTP 500… 403 would be preferable
add_filter( 'json_authentication_errors', function( $authenticated ) {
if( !$authenticated ) {
return new WP_Error('Access Denied');
}
}, 99 );
(I understand this’ll work for Basic Auth too)
Related Posts:
- What is the OAuth 2.0 Bearer Token exactly?
- Sign in with Google temporarily disabled for this app
- “An access token is required to request this resource” while accessing an album / photo with Facebook php sdk
- How do I use the WP REST API plugin and the OAuth Server plugin to allow for registration and login?
- Implement authentication to an organization oAuth server
- OAuth1 empty “authentication” in /wp-json
- WP – API – OAuth 1.0a Server, How to implement with AngularJS?
- oAuth2 Authentication in WordPress using WP OAuth Server and WP API plugins
- WordPress Plugin: Oauth2 redirect
- What is an Endpoint?
- Use Device Login on Smart TV / Console
- Constructing requests with URL Query String in Python
- localhost/phpinfo.php
- What are the main differences between JWT and OAuth authentication?
- Facebook OAuth “The domain of this URL isn’t included in the app’s domain”
- Install oAuth PECL error: Cannot install, php_dir for channel “pecl.php.net” is not writeable by the current user
- where is devise implementation of “authenticate_user!” method?
- Discord OAuth2 redirect URI how-to
- Hiding WordPress REST API v2 endpoints from public viewing
- Get WP Navigation Menu from REST API V2
- How do I access the body of a WP API request in a custom route?
- Get post count in wp rest API v2 and get all categories
- Override WordPress user with Oauth2 account
- Query WP REST API v2 by multiple meta keys
- Show popular post in another php website via WP REST JSON API
- Uploading media with the REST API
- WP-API v2 Custom Endpoint Response Formatting
- How do I cache (core) API requests?
- Implementing Isomorphic JavaScript (React JS) in WordPress?
- WP REST API only returning partial list of users
- Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- WP API returning SQL results as strings, rather than numbers
- Are there server performance benefits to fetching only specific fields when querying the REST API?
- wp rest api v2 return json_no_route
- WordPress Rest API
- Retrieving pages with multiple tags using REST API
- How to allow users login to WP from external domain and make REST requests
- Insert variations via woocommerce api [closed]
- Fetching private posts or custom post types via WP-API with basic authentication
- WP-REST API not returning all its endpoints, 404 on documented endpoints
- Custom endpoint and X-WP-TotalPages (headers)
- WP Rest API v2 filter and display latest post with specific tag
- WordPress Rest API: How do we validate with our custom API key?
- How to update/insert custom field(post meta) data with wordpress REST API?
- How to save new transients if query changes?
- How to loop through JSON data in wordpress WP REST API
- WP API V2 returning Invalid User ID
- Unset data in custom post type WordPress API (wp-json)
- Can I list all installed plugins/versions and wp version from API
- How do I retrieve a list of popular plugins using the WordPress.org Plugin API?
- WP API : date_query parameter
- How to filter or search the posts using postmeta tables custom meta fields with wordpress REST API
- How to build a plugin that supports authenticated POST requests to the REST API from external servers?
- Hiding API routes list
- WP REST API V2 – Modifying responses
- WordPress wp-json API – Custom Post Type returns 403
- Get the Category Name instead of ID from WP-API
- Get more than 10 posts in a specific category with the wordpress api
- WP API to fetch all the media/posts records if count is more than 100
- Add Products to Woocommerce through WP API
- WP REST API – Retrieve content from page
- OAuth signature does not match
- Updata Metadata WP Rest API
- How to upload image to wordpress from external page
- Authentication for a mobile app connected via wp-rest api?
- Add media with WP-Rest-API v2 II
- How do I authenticate WP users from a chrome extension?
- $_SESSION variables lost during OAuth callback
- wordpress custom endpoint multiple params
- Can we access the REST request parameters from within the permission_callback to enforce a 401 by returning false?
- Create post with REST API in php with file_get_contents
- WordPress REST API “rest_authentication_errors” doesn’t work external queries?
- Create a php callback/endpoint for an OAuth script
- Keep getting 401 error from WordPress on AWS Lightsail
- Should I ask my Twitter plugin users to create their own Twitter App and API Keys to use my plugin?
- WP-API and Basic Auth returning 403 on POST but not GET
- WordPress API returns empty page when page is less than X-WP-TotalPages
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- WP Rest API max limit include parameter?
- How to filter users on custom meta fields in WP JSON v2?
- Passing Meta array in wp-rest api
- How to make a WP REST API query with meta_query in WP4.7?
- Use WordPress with a custom OAuth2 provider
- WP API to fetch all records for /posts, /media, /categories
- Authenticated request to WP REST API V2 returning 403 error on /users/me [closed]
- How to retrieve custom meta term of category taxonomy from WP Rest API?
- Gutenberg Custom Block Getting All Posts
- Inserting custom post meta value using WP-REST API
- node-wpapi: how to handle authentication?
- Get all tags not just first 10 with wp api 2.0
- Mass importing json data into custom fields (postmeta)
- Backbone.js and WP API
- React post to WordPress custom post type
- Post body not working with wp_remote_post()
- PHP Fatal error: Cannot use object of type WP_REST_Response as array in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
- WP Rest API get page from path
- How to add WP API and JS featured image attachment
- Where to store OAuth 2.0 client id and secret?
- WP REST API V2 – Add user data to response
- How to quickly reorder posts in the admin panel that will persist for the wp-api