I am using a library to access the API of a cloud service called ShareFile. They have a .NET library of methods available, from which I am trying to use the authenticate method called Password Authentication, in the documentation. My implementation looks like this:
public async Task Authenticate(string username, string password)
{
try
{
Debug.WriteLine("Retrieving OAuthService...");
OAuthService service = new OAuthService(client, clientId, clientSecret);
Debug.WriteLine("Retrieving OAuthToken...");
OAuthToken token = await service.PasswordGrantAsync(username, password,
subdomain, applicationControlPlane); // This line seems to fail
Debug.WriteLine("Adding credentials...");
client.AddOAuthCredentials(token);
Debug.WriteLine("Adding base URI");
client.BaseUri = token.GetUri();
Debug.WriteLine("Authentication complete...");
}
catch (Exception ex)
{
throw new Exception("Unable to authenticate", ex);
}
}
The remaining variables, are fields in the class. My problem however is this: The code simply aborts, at the line OAuthToken token = await (...)
, with no error what-so-ever. Have I done something wrong in the implementation of the method/task, or is it simply the library which is poorly implemented?