you can user the available get/post filters to add authorization headers
for example
add_filter( 'qs_cf7_api_get_args' , 'add_auth_headers' );
add_filter( 'qs_cf7_api_get_args' , 'add_auth_headers' );
function add_auth_headers( $args ){
//for example
$args['headers']['Authorization'] = 'Basic ASJKH23HKSS' ;
}
@querysolutions where would I add that code?
Edit: I figured it out.
I tried adding
add_filter( ‘qs_cf7_api_get_args’ , ‘add_auth_headers’ );
add_filter( ‘qs_cf7_api_get_args’ , ‘add_auth_headers’ );
function add_auth_headers( $args ){
//for example
$args[‘headers’][‘Authorization’] = ‘Basic ASJKH23HKSS’ ;
}
But I am getting {“errorMessage”:”Authentication is required. Use Basic HTTP Authentication method with API Key as username and blank password.”}
I can keep password blank and use the API Secret as the Username, not sure what I am doing wrong here.
So the add_filter should be placed in functions.php
I placed the code there and changed your example to my Authorization key = Bearer 2:edfbe9c358bb6925bc6………………………..
But im still getting the following error:
[body] => {"success":false,"error":{"code":"Unauthorized","message":"Unauthorized request"}}
[response] => Array
(
[code] => 401
[message] => Unauthorized
)