Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

Insert OAuth Token in a web_add_header in Vugen script

$
0
0

Hi Experts,

I have a token authetincation (OAuth Token) that I want to insert in a web_add_auto_hearder function to perform a REST API call by a web_custom_request.

And the way I'm do it doesn't work, once the script reach the web_custom_request the response is we don't have the authorization to make the call even the token value has been saved in a correlation parameter.

The authentication token response format is: 

    "access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "token_type": "Bearer",
    "expires_in": 2363

I saved access_token value in a correlation parameter to be used in the web_add_auto_header:

web_add_auto_header("Authorization","OAuth {access_token}");

also tried as

web_add_auto_header("Authorization","OAuth lr_eval_string({access_token}"));

** REST API Call

    web_custom_request("Rest Call", 
        "URL=https://xxxxxxxxxxxxxxxxxxxxx", 
        "Method=POST",  
        "Resource=0", 
        "RecContentType=application/json", 
        "EncType=application/xml", 
        "Snapshot=t6.inf", 
        "Mode=HTML",       
        LAST);

I tested the same values in SOAPUI application and I can get a response back from REST CALL.

Please advise.

Thanks

Cesar Resendiz


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>