Interface IOAUTHClient
Represents the authorization client.
Namespace: UOL.SDK.Authorization
Assembly: UOL.SDK.dll
Syntax
public interface IOAUTHClient
Methods
Authorize(String, String, String)
Gets a new access token using a previously acquired refresh token.
Declaration
AuthorizationResult Authorize(string clientId, string clientSecret, string refreshToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientId | Specifies the client id. |
System.String | clientSecret | Specifies the client secret id. |
System.String | refreshToken | Specifies the refresh token. |
Returns
Type | Description |
---|---|
AuthorizationResult | An AuthorizationResult object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any of the parameters is empty. |
Authorize(String, String, String, String)
Gets a new access and refresh token by executing the OAUTH2.0 Authorization Code flow using a username and a password.
Declaration
AuthorizationResult Authorize(string clientId, string clientSecret, string username, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientId | Specifies the client id. |
System.String | clientSecret | Specifies the client secret id. |
System.String | username | Specifies the user name. |
System.String | password | Specifies the password. |
Returns
Type | Description |
---|---|
AuthorizationResult | An AuthorizationResult object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any of the parameters is empty. |
AuthorizeAsync(String, String, String)
Asynchronously gets a new access token based on a previously acquired refresh token.
Declaration
Task<AuthorizationResult> AuthorizeAsync(string clientId, string clientSecret, string refreshToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientId | Specifies the client id. |
System.String | clientSecret | Specifies the client secret id. |
System.String | refreshToken | Specifies the refresh token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<AuthorizationResult> | A System.Threading.Tasks.Task<TResult> object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any of the parameters is empty. |
AuthorizeAsync(String, String, String, String)
Asynchronously gets a new access and refresh token by executing the OAUTH2.0 Authorization Code flow using a username and a password.
Declaration
Task<AuthorizationResult> AuthorizeAsync(string clientId, string clientSecret, string username, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientId | Specifies the client id. |
System.String | clientSecret | Specifies the client secret id. |
System.String | username | Specifies the user name. |
System.String | password | Specifies the password. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<AuthorizationResult> | A System.Threading.Tasks.Task<TResult> object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any of the parameters is empty. |
ExchangeAuthorizationCode(String, String, String)
Exchanges an authorization code for an access token and refresh token by executing the second part of the OAUTH 2.0 Authorization Code flow.
Declaration
AuthorizationResult ExchangeAuthorizationCode(string clientId, string clientSecret, string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientId | Specifies the client id. |
System.String | clientSecret | Specifies the client secret. |
System.String | code | Specifies the authorization code. |
Returns
Type | Description |
---|---|
AuthorizationResult | A AuthorizationResult object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any of the parameters is null or empty. |