If the API requires an authorization as Bearer token, just write is as Bearer and not as Basic:
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => 'Beaerer Base64enodedusercredentials',
);
Also take a look at the documentation of this API.
Also, make sure that you are currently duplicating the feedback in both of your functions. The 2nd function would be completely sufficient:
function api_authentication_test_shortcode() {
return authenticate_api();
}
add_shortcode('api_authentication_test', 'api_authentication_test_shortcode');
Related Posts:
- 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?
- Google credentials and redirect URI for Google OAuth2 in a WordPress plugin, questions
- How do WordPress plugins work with oAuth2 APIs?
- 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
- 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
- How to duplicate a curl XML request using HTTP API?
- How to convert this cURL to wp_remote_get?
- Example Dashboard Widget, Cancel not working
- How to run a function on plugin’s options page?
- 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?
- Adding custom end points, No error line
- Sending post request with wp_remote_post not working correctly
- woocommerce_checkout_order_processed hook executing function twice
- Authorizing a plugin to call Google Analytics v4 API on wp_cron
- What to hook into to check a value before a post is published?
- Add information to HTTP Header in WordPress Plugin
- Encoding Method for URLs?
- Plugin index page code executes multiple times
- Pass CF7 form data to plugin
- Best way to ping for the API changes in the wordpress?
- How to set a header in wp_safe_remote_get()?
- 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
- Allow REST API Endpoint to specific user and hide from public
- 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
- Adding Amchart Interface to WordPress API
- 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
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- add pagination to wp_remote_get
- Multisite and the JSON REST API: How to?
- How to debug new shortcode? And how to get string from shortcode into code?
- API WordPress is Limited? Return False
- 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
- Email verification feature in wordpress social login plugin
- How can I interact with a third party service that sends POST requests to me in response to the order information that I send them?
- How to update WordPress Plugins in your own maintance application?
- Why is this specific API request failing when sending via wp_remote_post?
- Programmatically creating posts based on external JSON feed (asynchronously)
- External api call using wordpress
- how to send csv file to other server using wp_remote_post?
- How do I return XML to an API post request
- wp_nonce_field displaying twice
- WP Cron being triggered but not working as expected
- Plugin Options Array Set to Undefined
- is pre_get_comments not working?
- Settings API – format container of setting and setting’s description
- Delete option of a Plugin
- Automating the process of shortcode generation in a plugin – how is it done?
- Apply function to update_option Variable
- Proper way to include stylesheet for panels
- How to make and save custom form in custom plugin page?
- Get thumbnails with array sizes parameter
- Why would someone use function_exists(‘add_action’) in a plugin?
- WordPress Gutenberg InnerBlocks renderAppender not showing with template
- Duplicate shipping method logic to another shipping method [closed]
- Add a custom menu item that supports wildcards
- jQuery UI tab does not work in the plugin page
- How to share user data across multiple WordPress websites?
- Load stylesheet in edit category page?
- How to properly create table in plugin
- Error code when migrate
- Add two button to page and post admin to redirect to : add new & list of (posts – pages) just after saving post or page
- How to add .ini file type to the plugin editor to read and edit?
- WordPress: I wanted to use Add rewrite rule multiple times for multiple CPT in my plugin
- WordPress Ajax not returning Response
- Group By in a Metaquery
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- Remove from a div by class name from post page if post author role is not administrator
- Getting duplicate page when activating my plugin
- Enqueue script not working
- Modify request query string before plugins
- auto create only 1 wp page in activate custom plugin
- Include add_post_meta in a plugin
- Submit form stored in one plugin from another plugin?
- isset($_POST[‘submit’]) ignored on comment submission
- how to insert content into wp_head after loop_end