Authorization

7 posts, 0 answers
  1. Tatsiana
    Tatsiana avatar
    2 posts
    Member since:
    Oct 2016

    Posted 27 Oct 2016 Link to this post

    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

  2. Oleg
    Admin
    Oleg avatar
    37 posts

    Posted 28 Oct 2016 Link to this post

    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
  3. Tatsiana
    Tatsiana avatar
    2 posts
    Member since:
    Oct 2016

    Posted 28 Oct 2016 Link to this post

    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

  4. Oleg
    Admin
    Oleg avatar
    37 posts

    Posted 28 Oct 2016 Link to this post

    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
  5. Jonathan
    Jonathan avatar
    2 posts
    Member since:
    Jul 2017

    Posted 14 Jul Link to this post

    Hi all, how do I use an API key?

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

  6. Oleg
    Admin
    Oleg avatar
    37 posts

    Posted 19 Jul Link to this post

    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
  7. Jonathan
    Jonathan avatar
    2 posts
    Member since:
    Jul 2017

    Posted 19 Jul in reply to Oleg Link to this post

    Got it figured out. It just needed to be added as a variable header. All sorted.
Back to Top