private ICredential GetCredentials()
{
ICredential returnCredential = null;
try
{
CredentialManager credentialMngr = CredentialManager.Instance;
returnCredential = credentialMngr.GetCredentials(this.config, apiUserName);
if (!string.IsNullOrEmpty(accessToken))
{
// Set third party authorization to token
// if token is sent as part of request call
IThirdPartyAuthorization thirdPartyAuthorization = new TokenAuthorization(accessToken, tokenSecret);
if (returnCredential is SignatureCredential)
{
SignatureCredential signCredential = (SignatureCredential)returnCredential;
signCredential.ThirdPartyAuthorization = thirdPartyAuthorization;
}
else if (returnCredential is CertificateCredential)
{
CertificateCredential certCredential = (CertificateCredential)returnCredential;
certCredential.ThirdPartyAuthorization = thirdPartyAuthorization;
}
}
}
catch(System.Exception ex)
{
throw ex;
}
return returnCredential;
}