Http Request Step Authorization
DEPRECATED
This article is related to Test Studio for APIs version R3 2016 or older which do not yet have built-in support for authorization.
For version R1 2017 or newer see here.
You can enable Basic and OAuth authorization for any Http Request step by following the steps below.
Basic
Basic authentication is the simplest technique for enforcing access controls to web resources. The mechanism provides no confidentiality protection for the transmitted credentials. The username and password are encoded with Base64 and are added as a custom request header.
Create 3 new variables as shown below.
credentials-concatenated
is a variable that contains theusername
andpassword
variables concatenated by a:
Add a Set Variable step that will transform the credentials-concatenated
variable to a Base64 string and store it in a new variable called credentials-encoded
Add an Http Request step and add an Authorization
to the list of headers and set its value to Basic
.
OAuth
Enabling OAuth authentication on a REST service api call can be achieved by combining Basic authentication and sending url encoded parameters using an x-www-form-urlencoded
body.
1.Follow all the steps described in the Basic authentication section.
2.Add a new request header Content-Type
and set its value to application/x-www-form-urlencoded
3.Add all the necessary authentication parameters to the Body
of the request.