This is a migrated thread and some comments may be shown as answers.

Authorization

6 Answers 190 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tatsiana
Top achievements
Rank 1
Tatsiana asked on 27 Oct 2016, 12:52 PM

Hi all, my API requires authorization, but I'm not sure how to add Username/Password and the Authorization type.

Could you please provide an example?

 

Thanks in advance.

Tania

6 Answers, 1 is accepted

Sort by
0
Oleg
Telerik team
answered on 28 Oct 2016, 11:42 AM
Hello Tania,

The Beta version of Test Studio for APIs does not have UI support for authorization yet (I hope we will be able to deliver this soon in our future releases).

Though you can make authorized calls, but you would need to manually set the attributes required for your http requests. You mentioned that you need to add Username/Password and Authorization type so you probably mean that you need to use Basic authentication. In that case, you can use an "Authorization" header with value: "Basic your-base64-encoded-credentials-here".

I have attached a sample project so that you could see an example. You can see in the sample, that I have declared two variables in the test case for "username" and "password", and a third one "credentials-concatenated" that I use to concatenate the two together with a colon ":" in the middle. I have used a Set-Variable step that applies Base64 encoding to the "credentials-concatenated" and saves the result in a "credentials-encoded" variable. Finally, in the http request, I have added an "Authorization" header with value: "Basic {{credentials-encoded}}". The {{credentials-encoded}} part will be replaced with the Base64-encoded credentials (you can see more about referencing variables here).

If you need to use another type of authentication instead of Basic, you can achieve it in a similar manner, just check what headers/ query strings/ payload your service expects to receive.

Let us know if we can be of further assistance.

Regards,
Oleg
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tatsiana
Top achievements
Rank 1
answered on 28 Oct 2016, 12:05 PM

Hi Oleg.

Thnaks for the assistance. Will check you variant with Basic authentication soon.

Actually we have 3 types of authentication, each of them can be enabled on demand (Basic, Form-based, sertificates). Hope you will support all of them :)

 

Regards, 

Tania

0
Oleg
Telerik team
answered on 28 Oct 2016, 03:27 PM
Hi Tania,

Thanks for the clarification. Please take your time and share your observations once you have any results. I will be glad to assist you further in case you need further assistance.

Regards,
Oleg
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jonathan
Top achievements
Rank 1
answered on 14 Jul 2017, 07:57 PM

Hi all, how do I use an API key?

I see there is now an option for basic and 2.0 authorization, but not sure how an key would fit within these, if at all. We are using . Any help would be appreciated.

0
Oleg
Telerik team
answered on 19 Jul 2017, 04:44 PM
Hi Jonathan,

Indeed, as you mentioned, Test Studio for APIs now supports Basic and OAuth 2.0 authorization as a built-in option in the UI. This makes the use cases, mentioned earlier in this thread, much easier to accomplish.

As for API keys, I am afraid there is no straight-forward answer, because "API key" is a general concept that can be implemented differently in different services. In some cases it is passed in the request as a header, as part of the request body or even as part of the URL path or query string in the URL. All of these options are easily supported in Test Studio for APIs, but you will have to provide more information about how your service expects an API key to be provided in a http request.

Regards,
Oleg
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jonathan
Top achievements
Rank 1
answered on 19 Jul 2017, 04:52 PM
Got it figured out. It just needed to be added as a variable header. All sorted.
Tags
General Discussions
Asked by
Tatsiana
Top achievements
Rank 1
Answers by
Oleg
Telerik team
Tatsiana
Top achievements
Rank 1
Jonathan
Top achievements
Rank 1
Share this question
or