Click or drag to resize
NonAuthenticatedSessionExecuteAsync Method
Executes the ITokensRequest asynchronously.

Namespace: KomfoSharp.Sessions.NonAuthenticated
Assembly: KomfoSharp (in KomfoSharp.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public Task<ITokensResponse> ExecuteAsync(
	ITokensRequest tokensRequest
)

Parameters

tokensRequest
Type: KomfoSharp.Sessions.NonAuthenticated.Requests.OAuth20.TokensITokensRequest
The tokens request.

Return Value

Type: TaskITokensResponse
The TaskTResult.

Implements

INonAuthenticatedSessionExecuteAsync(ITokensRequest)
Examples
using (var komfoSession = komfoSessions
  .NonAuthenticated
  .Create())
{
  var tokensRequest = komfoSession.Requests.OAuth20.Tokens
    .ClientId("<your_client_id>")
    .ClientSecret("<your_client_secret>")
    .Scopes(TokenScopes.TwitterFollowers | TokenScopes.Advertising)
    .Create();

  var tokensResponse = await komfoSession.ExecuteAsync(tokensRequest);

  Console.WriteLine("Access Token: {0}, expires in: {1} days.", tokensResponse.Data.AccessToken, tokensResponse.Data.ExpiresIn.TotalDays);
}
See Also