Here is my solution.
Inside the callback function I validate Authorization
from the header like this:
function callback_function($data) {
//Get HTTP request headers
$auth = apache_request_headers();
//Get only Authorization header
$valid = $auth['Authorization'];
// Validate
if ($valid == 'Basic Base64UsernamePassword') {
//Do what the function should do
} else {
$response="Please use a valid authentication";
}
return json_encode($response);
}
Related Posts:
- Adding custom end points, No error line
- Allow REST API Endpoint to specific user and hide from public
- Adding Amchart Interface to WordPress API
- How to update WordPress Plugins in your own maintance application?
- External api call using wordpress
- Difference Between Filter and Action Hooks?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- How to create an API for my plugin?
- How to store username and password to API in wordpress option DB?
- Is there a limit on making calls to WordPress.org API’s?
- Using filters and actions for plugin API?
- WordPress and multithreading
- permalinks with get variables
- Add Products to Woocommerce through WP API
- Build dynamic page from cURL (HTML page) response with plugin
- How to override a function call in functions.php?
- wp_enqueue_style built in styles
- Should I ask my Twitter plugin users to create their own Twitter App and API Keys to use my plugin?
- Does WordPress’s HTTP API use any caching?
- WP REST API V2 – Add user data to response
- Example Dashboard Widget, Cancel not working
- Amending REST API function without deactivate/activate plugin every time changes is made
- Why does wp_remote_post returns an empty body response on certain endpoints?
- Sending post request with wp_remote_post not working correctly
- woocommerce_checkout_order_processed hook executing function twice
- What to hook into to check a value before a post is published?
- rest_no_route on custom API endpoint wordpress
- Encoding Method for URLs?
- Google credentials and redirect URI for Google OAuth2 in a WordPress plugin, questions
- update_callback is not working in register_rest_field
- Plugin index page code executes multiple times
- Pass CF7 form data to plugin
- Best way to ping for the API changes in the wordpress?
- Plugin architecture to pull from API & create dynamic content on WP site?
- Lead form that submits to 2 external APIs
- Widget internal hooks and functions
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Get API auth_token token to renew weekly
- How to query a nested field in wordpress api using _fields param
- call funcution when clicking submit
- 403 error rest_’cookie_invalid_nonce’ on API Request
- How do I make secure API calls from my WordPress plugin?
- Generate Static Page to Show Search Results/Detail for API
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- add pagination to wp_remote_get
- Multisite and the JSON REST API: How to?
- How do WordPress plugins work with oAuth2 APIs?
- API WordPress is Limited? Return False
- WP API users per page
- Tie specific functions to options-update for limiting API requests
- Do you see any problems (mainly security-related) with how I’ve used wp_ajax_* actions?
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Can a plugin differentiate syndication feeds from actual site views?
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- add_rewrite_rule not working
- How do I query posts and have their related taxonomies returned in the results?
- modify buddpress adminbar only in admin pages
- How can I create a custom plugin to call webapi after user registration?
- Programmatically creating posts based on external JSON feed (asynchronously)
- Can’t save Image from external API into Database
- WordPress getting data from external API
- how to send csv file to other server using wp_remote_post?
- How do I return XML to an API post request
- Show Image in Plugin Development
- how to handle premium features in a wordpress plugin?
- Sanitize WordPress Array Input?
- How to know if current plugin is going to be used while rendering the page?
- How the add_action is included in the plugin development
- Dynamically modify content added to table via javascript
- Disabling Yoast, All-in-One, and Rank Math on Certain Pages within a Plugin
- How to show content in the body with my plugin (only in frontend not backend)?
- Show username only if logged in in a else no directly name
- Metabox types list
- How to limit number of category term display in home page grids?
- how to create a shortcode from a variable in plugin
- Conditionally check if page is using template from plugin directory
- plugin css is not being applied to the page
- How to direct WordPress to load custom template for custom post type
- Any way, hook to add content right before the “read more” link?
- A question on init and activation hooks
- get_the_tags doesn’t works?
- Is it possible to develop themes and plugins locally while still allowing content to be updated directly in the admin dashboard?
- Is there any way to get post meta from publish_post hook?
- How do I specify where to save the debug.log?
- Dont display post with no content
- WordPress API “code”:”rest_no_route” with Custom Route
- Custom User Role Preview Function Not Working
- get_the_date() returns english Year & Day when language is Arabic
- Where to save Gutenberg plugin data?
- WP_Fatal_Error_Handler OR WP_Error OR try/catch
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- Custom table / Alternative to WP_List_Table
- is it possible to fetch data from a remote api while admin is writing a new post?
- Quick Draft widget (dashboard.php) using custom post_type
- Buddypress: adding a new tab direct user to their author page
- Add a custom submenu under submenu in a Custom WordPress Plugin
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- Why would one specify multiple arguments when using get_previous_posts_link() which takes only one parameter?
- WordPress Jquery with heade and footer sritp plugin