cancel
Showing results for 
Search instead for 
Did you mean: 

How to test REST API with Login Authentication

Highlighted
New Contributor

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

Tags (2)
4 REPLIES 4
Highlighted
New Contributor

Re: How to test REST API with Login Authentication

Never mind..I just need to add Auth 🙂

Highlighted
Community Hero

Re: How to test REST API with Login Authentication

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
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Highlighted
New Contributor

Re: How to test REST API with Login Authentication

@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.

 

 

 

 

Highlighted
Community Hero

Re: How to test REST API with Login Authentication

,

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
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
New Here?
Join us and watch the welcome video:
Top Kudoed Authors