REST API Integration with 3rd party - 401 Error

Priyanka Gupta
Mega Guru

Hi everyone,

I am trying to connect to 3rd party system using Outbound REST API. I wanted to understand what am I doing wrong in the authentication.

Endpoint is the GET API I am trying to refer-

http://*********************/tfs/*************/_apis/wit/workitems/116536?api-version=3.2

I am selecting the Authentication as Basic with my 3rd party userName and password. Our 3rd party server is on premise and we use our network credentials to login to that system. The network credentials are the username and password I have fed here.

find_real_file.png

I am also sending Authorization header in the request as -

find_real_file.pngThe GET and POST APIs are working fine in Fiddler. 

Here's a screenshot of the Test-

find_real_file.png

 

Any suggestions would be helpful.

Thanks,

Priyanka

1 ACCEPTED SOLUTION

Priyanka Gupta
Mega Guru

For all those who are running into the same issue as me,

You can either perform authentication through the Basic Auth/ Outh2.0 methods available on the REST API form, or you can send an Authorization header in the request. Doing both will not help you.

For the solution of this problem, I set my Authorization header as-

Authorization :  Basic <myTokenHere>

Note- Your Authorization header can be different from mine depending upon the 3rd party system's API. My 3rd party was TFS.

find_real_file.png

and I set the Authentication to 'No Authentication'

find_real_file.png

This basically allowed my API to authenticate through token instead of the username and password specified in Basic Auth Profile.

Happy coding,

Priyanka

 

View solution in original post

8 REPLIES 8

Hey Aman,

I did set the MID server for the call. Thank you for your reply.

I have figured out why this wasn't working in the first place. Will post my solution as a separate comment here.

Thanks,

Priyanka

Rahul Priyadars
Giga Sage
Giga Sage

error clearly say about authentication issue . Install POSTMAN App and then make  a call from there.

 

find_real_file.png

 

Regards

RP

Hi Rahul,

Yes, I know what the error means. As I wrote in my above reply, I already ran my API on Fiddler (a REST API Client like Postman) before I started running it on SN and things didn't pan out well.

Anyways, I have figured out why and would be posting my solution as a separate comment.

Thank you,

Priyanka

Priyanka Gupta
Mega Guru

For all those who are running into the same issue as me,

You can either perform authentication through the Basic Auth/ Outh2.0 methods available on the REST API form, or you can send an Authorization header in the request. Doing both will not help you.

For the solution of this problem, I set my Authorization header as-

Authorization :  Basic <myTokenHere>

Note- Your Authorization header can be different from mine depending upon the 3rd party system's API. My 3rd party was TFS.

find_real_file.png

and I set the Authentication to 'No Authentication'

find_real_file.png

This basically allowed my API to authenticate through token instead of the username and password specified in Basic Auth Profile.

Happy coding,

Priyanka