• Resolved Kostas Pinakas

    (@flyingfinn64)


    Hello where i can set the x api key and the authorization for the connected rest api in the plugin?

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Qube One ltd

    (@querysolutions)

    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' ;
    }
    • This reply was modified 6 years, 7 months ago by Qube One ltd.

    @querysolutions where would I add that code?

    Edit: I figured it out.

    • This reply was modified 6 years, 6 months ago by Kenny Meyer.

    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
            )
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘x api key and authorization’ is closed to new replies.