Skip to content

Latest commit

 

History

History
174 lines (122 loc) · 5.27 KB

o-auth.md

File metadata and controls

174 lines (122 loc) · 5.27 KB

O Auth

IOAuthApi oAuthApi = client.OAuthApi;

Class Name

OAuthApi

Methods

Renew Token

RenewToken is deprecated. For information about refreshing OAuth access tokens, see Renew OAuth Token.

Renews an OAuth access token before it expires.

OAuth access tokens besides your application's personal access token expire after 30 days. You can also renew expired tokens within 15 days of their expiration. You cannot renew an access token that has been expired for more than 15 days. Instead, the associated user must re-complete the OAuth flow from the beginning.

Important: The Authorization header for this endpoint must have the following format:

Authorization: Client APPLICATION_SECRET

Replace APPLICATION_SECRET with the application secret on the Credentials page in the application dashboard.

ℹ️ Note This endpoint does not require authentication.

RenewTokenAsync(string clientId, Models.RenewTokenRequest body, string authorization)

Parameters

Parameter Type Tags Description
clientId string Template, Required Your application ID, available from the application dashboard.
body Models.RenewTokenRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
authorization string Header, Required Client APPLICATION_SECRET

Response Type

Task<Models.RenewTokenResponse>

Example Usage

string clientId = "client_id8";
var body = new RenewTokenRequest.Builder()
    .AccessToken("ACCESS_TOKEN")
    .Build();
string authorization = "Client CLIENT_SECRET";

try
{
    RenewTokenResponse result = await oAuthApi.RenewTokenAsync(clientId, body, authorization);
}
catch (ApiException e){};

Revoke Token

Revokes an access token generated with the OAuth flow.

If an account has more than one OAuth access token for your application, this endpoint revokes all of them, regardless of which token you specify. When an OAuth access token is revoked, all of the active subscriptions associated with that OAuth token are canceled immediately.

Important: The Authorization header for this endpoint must have the following format:

Authorization: Client APPLICATION_SECRET

Replace APPLICATION_SECRET with the application secret on the Credentials page in the application dashboard.

ℹ️ Note This endpoint does not require authentication.

RevokeTokenAsync(Models.RevokeTokenRequest body, string authorization)

Parameters

Parameter Type Tags Description
body Models.RevokeTokenRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
authorization string Header, Required Client APPLICATION_SECRET

Response Type

Task<Models.RevokeTokenResponse>

Example Usage

var body = new RevokeTokenRequest.Builder()
    .ClientId("CLIENT_ID")
    .AccessToken("ACCESS_TOKEN")
    .Build();
string authorization = "Client CLIENT_SECRET";

try
{
    RevokeTokenResponse result = await oAuthApi.RevokeTokenAsync(body, authorization);
}
catch (ApiException e){};

Obtain Token

Returns an OAuth access token.

The endpoint supports distinct methods of obtaining OAuth access tokens. Applications specify a method by adding the grant_type parameter in the request and also provide relevant information. For more information, see OAuth access token management.

Note: Regardless of the method application specified, the endpoint always returns two items; an OAuth access token and a refresh token in the response.

OAuth tokens should only live on secure servers. Application clients should never interact directly with OAuth tokens.

ℹ️ Note This endpoint does not require authentication.

ObtainTokenAsync(Models.ObtainTokenRequest body)

Parameters

Parameter Type Tags Description
body Models.ObtainTokenRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.ObtainTokenResponse>

Example Usage

var body = new ObtainTokenRequest.Builder(
        "APPLICATION_ID",
        "APPLICATION_SECRET",
        "authorization_code")
    .Code("CODE_FROM_AUTHORIZE")
    .Build();

try
{
    ObtainTokenResponse result = await oAuthApi.ObtainTokenAsync(body);
}
catch (ApiException e){};