First, credentials are given for authentication with said API:
Webservice.Authenticate.Credential credential = new Webservice.Authenticate.Credential
{
Username = "myUserName",
Password = GetMD5("myPassword"), // See below for a MD5 encoding example method
ApplicationId = new Guid("00000000-0000-0000-0000-000000000000"), //YOUR ID HERE
IdentityId = new Guid("00000000-0000-0000-0000-000000000000") //Default is empty guid (no need to edit this)
};
If I try to directly utilize the credentials as Icredentials, like so _service.Credentials = credential;
the following error occurs:
Cannot implicitly convert type auth.credential to system.net.icredentials. I attempted to cast it, but it did not work correctly.
Later, I tried to utilize the credentials in this manner when another service is called. However, I am unsure of how to pass the credentials.
TransactionService.TransactionService _service = new TransactionService.TransactionService();
TransactionService.TransactionSearchParameters _params = new TransactionService.TransactionSearchParameters();
_service.Credentials = new NetworkCredential(credential.Username, credential.Password);
System.Net.ICredentials is a collection.
Try:
_service.Credentials.Add("uri:my.uri"
, "authenticationType"
, new NetworkCredential(credential.Username, credential.Password)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With