Class Credentials
Represents credentials for Vonage APIs.
public class Credentials
- Inheritance
-
Credentials
- Inherited Members
Properties
ApiKey
Vonage API Key (from your account dashboard)
public string ApiKey { get; }
Property Value
ApiSecret
Vonage API Secret (from your account dashboard)
public string ApiSecret { get; }
Property Value
AppUserAgent
(Optional) App useragent value to pass with every request
public string AppUserAgent { get; }
Property Value
ApplicationId
Application ID (GUID)
public string ApplicationId { get; }
Property Value
ApplicationKey
Application private key contents This is the actual key file contents and NOT a path to the key file!
public string ApplicationKey { get; }
Property Value
Method
Method to be used for signing SMS Messages
public SmsSignatureGenerator.Method Method { get; }
Property Value
SecuritySecret
Signature Secret (from API settings section of your account settings)
public string SecuritySecret { get; }
Property Value
Methods
FromApiKeyAndSecret(string, string)
Builds credentials from ApiKey and ApiSecret.
public static Credentials FromApiKeyAndSecret(string apiKey, string apiSecret)
Parameters
Returns
- Credentials
The credentials.
FromApiKeySignatureSecretAndMethod(string, string, Method)
Builds Credentials from ApiKey, SignatureSecret and Method.
public static Credentials FromApiKeySignatureSecretAndMethod(string apiKey, string signatureSecret, SmsSignatureGenerator.Method signatureMethod)
Parameters
apiKeystringThe api key.
signatureSecretstringThe signature secret.
signatureMethodSmsSignatureGenerator.MethodThe signature method.
Returns
- Credentials
The credentials.
FromAppIdAndPrivateKey(string, string)
Builds Credentials from ApplicationId and PrivateKey.
public static Credentials FromAppIdAndPrivateKey(string appId, string privateKey)
Parameters
Returns
- Credentials
The credentials.
FromAppIdAndPrivateKeyPath(string, string)
Builds Credentials from ApplicationId and PrivateKey file.
public static Credentials FromAppIdAndPrivateKeyPath(string appId, string privateKeyPath)
Parameters
Returns
- Credentials
CredentialsObject
Exceptions
- UnauthorizedAccessException
Thrown if app doesn't have required permission to key file
- ArgumentException
privateKeyPath is a zero length string, contains only white space or contains one or more invalid characters
- ArgumentNullException
privateKeyPath is null
- PathTooLongException
The specified path, filename, or both exceed the system-defined max length
- DirectoryNotFoundException
The specified path is invalid, (for example, it is on an unmapped drive).
- FileNotFoundException
The file specified in path was not found.
- NotSupportedException
path is in an invalid format.
GetAuthenticationHeader()
Provides the preferred authentication based on authentication type.
public Result<AuthenticationHeaderValue> GetAuthenticationHeader()
Returns
- Result<AuthenticationHeaderValue>
The authentication header if it matches any criteria. A AuthenticationFailure otherwise.
GetPreferredAuthenticationType()
Provides the preferred authentication type.
public Result<AuthType> GetPreferredAuthenticationType()
Returns
- Result<AuthType>
The authentication type if it matches any criteria. A AuthenticationFailure otherwise.
Remarks
Bearer will always be preferred over Basic if possible.
GetUserAgent()
Returns the user agent from credentials if not null, from configuration otherwise.
public string GetUserAgent()
Returns
- string
The user agent.