Forum Discussion

bobtamayo's avatar
bobtamayo
New Contributor
5 years ago

How to test REST API with Login Authentication

Hi,

 

I am trying to test REST API. The login authentication has its own URI and it works when I test it. However, I have another URI but it requires the Login Authentication to execute first. So, what I did was I created a REST project, create a Resource for Login Authentication and another Resource for the other the URI. When  I ran the TestRunner, it does not seem to authenticate well. Is this the way to tests or is there another way?

 

 

Thanks

  • richie's avatar
    richie
    Community Hero
    Hey bobtamayo,

    If i understand correctly you have 2 requests:

    Request1 = request to generate auth token of some sort

    Request2 = request that needs testing

    You need to do some sort of property transfer of the token from Request1 to pass it to Request2 i'm guessing.

    What have you setup so far to do this?

    Cheers

    Rich
    • bobtamayo's avatar
      bobtamayo
      New Contributor

      richie 

       

      Thank you for the reply. For each Request, there's a Auth tab. So I just put the user and password there and it works.

       

       

       

       

      • richie's avatar
        richie
        Community Hero
        ,

        What you described using adding the username and password into the fields (which then get base64 encoded and added to your Authorization header) is known as basic auth.

        Nice one

        Rich