Auth for Rest API issues

CommunityMember123802
New Contributor

Auth for Rest API issues

Hello,

 

I have recently started to recieve the error "The underlying connection was closed: An unexpected error occurred on a send." when trying to authenticate with the REST Api. This code worked fine last week and now it's failing. I am using RestSharp/C#, can anyone see what my issue is? I don't believe that I have changed anything....

 

 

CommunityMember123802_0-1596741448071.png

 

8 REPLIES 8
anirudh
Community Boss

Re: Auth for Rest API issues

Hi,

Are you using 2.0 API or 1.3?

Regards,
Anirudh
CommunityMember123802
New Contributor

Re: Auth for Rest API issues

I am using 2.0. Here are is the base url and the auth url that i am using. 

 

https://auth.anaplan.com/token/authenticate

https://api.anaplan.com/2/0/

ABerenguela
Frequent Contributor

Re: Auth for Rest API issues

Hi,

 

did you try to login directly in the Anaplan home page with that user/pass?, maybe it expire 

 

Regards

CommunityMember123802
New Contributor

Re: Auth for Rest API issues

Sadly, the account is fine. And yes, I did check. That is why this is so frustrating.

dklover
New Contributor

Re: Auth for Rest API issues

Did you find a solution?

 

I'm having a similar issue. using api 2.0

Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send. 

 

Script works from UI but not when called from Informatica.

 

Research leaning toward tls issue, no success with the suggestions around forcing tls version.

CommunityMember123802
New Contributor

Re: Auth for Rest API issues

Yes, I did.  Check the project that is calling the Anaplan REST api and make sure that compiling for at least .NET 4.6(?). The issue is with the TLS version, <4.6 is using the older TLS version. It's not a verbose error, and needs some digging to find the root cause. 

dklover
New Contributor

Re: Auth for Rest API issues

My issue solved. I had to add -Proxy to the failing Invoke-WebRequest statement. Due to this being a service account, policy will not allow updating the IE settings directly.
dan999
Not applicable

Re: Auth for Rest API issues

Try something like this at the beginning of your method:

 

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

 

This appears to be an issue with the .NET web request rather than an Anaplan thing.