I am trying to get an access token using Forge DA using the code below. But it throws the following exception:
An exception of type 'Autodesk.Forge.Client.ApiException' occurred in mscorlib.dll but was not handled in user code. Additional information: Error calling Authenticate: The underlying connection was closed: An unexpected error occurred on a send.
Here is my code:
TwoLeggedApi oAuth = new TwoLeggedApi();
dynamic token = await oAuth.AuthenticateAsync(
txtClientId.Text,
txtClientSecret.Text,
oAuthConstants.CLIENT_CREDENTIALS ,
new Scope[] { Scope.BucketRead, Scope.BucketCreate, Scope.DataRead, Scope.DataWrite });
Since the error is calling out connection make sure your system can reach our service from your network (check proxy, firewall etc, can you reach our other endpoints?) and it supports TLS 1.2 - see here