Table of Contents

Interface OAuthFlow

Namespace
Smartsheet.Api.OAuth
Assembly
smartsheet-csharp-sdk.dll

OAuthFlow interface provides methods to do the OAuth2 authorization.

Thread Safety: Implementation of this interface must be thread safe.

public interface OAuthFlow

Methods

ExtractAuthorizationResult(string)

Extract AuthorizationResult from the authorization response URL (i.e. the RedirectURL with the response parameters from Smartsheet OAuth server).

AuthorizationResult ExtractAuthorizationResult(string authorizationResponseURL)

Parameters

authorizationResponseURL string

the authorization response Url

Returns

AuthorizationResult

the authorization RequestResult

Exceptions

UriFormatException

the URI syntax exception

AccessDeniedException

the access denied exception

UnsupportedResponseTypeException

the unsupported response Type exception

InvalidScopeException

the invalid scope exception

OAuthAuthorizationCodeException

the o auth authorization Code exception

InvalidOperationException

if any other error occurred during the operation

NewAuthorizationURL(IEnumerable<AccessScope>, string)

Generate a new authorization URL.

string NewAuthorizationURL(IEnumerable<AccessScope> scopes, string state)

Parameters

scopes IEnumerable<AccessScope>

the requested scopes

state string

an arbitrary string that will be returned to your app; intended to be used by you to ensure that this redirect is indeed from an OAuth flow that you initiated.

Returns

string

the authorization URL

Exceptions

InvalidOperationException

if scopes is null or empty

ObtainNewToken(AuthorizationResult)

Obtain a new token using AuthorizationResult.

Token ObtainNewToken(AuthorizationResult authorizationResult)

Parameters

authorizationResult AuthorizationResult

the authorization RequestResult

Returns

Token

the token

Exceptions

OAuthTokenException

the o auth token exception

JsonSerializationException

the JSON serializer exception

UriFormatException

the URI syntax exception

InvalidRequestException

the invalid request exception

InvalidOperationException

if any other error occurred during the operation

RefreshToken(Token)

Refresh token.

Token RefreshToken(Token token)

Parameters

token Token

the token to refresh

Returns

Token

the refreshed token

Exceptions

OAuthTokenException

the o auth token exception

JsonSerializationException

the JSON serializer exception

UriFormatException

the URI syntax exception

InvalidRequestException

the invalid request exception

InvalidOperationException

if any other error occurred during the operation

RevokeAllForApiClient(Token)

Revoke token.

void RevokeAllForApiClient(Token token)

Parameters

token Token

the token

Exceptions

OAuthTokenException

the o auth token exception

JsonSerializationException

the JSON serializer exception

UriFormatException

the URI syntax exception

InvalidRequestException

the invalid request exception

InvalidOperationException

if any other error occurred during the operation

RevokeToken(Token)

Revoke token.

void RevokeToken(Token token)

Parameters

token Token

the token

Exceptions

OAuthTokenException

the o auth token exception

JsonSerializationException

the JSON serializer exception

UriFormatException

the URI syntax exception

InvalidRequestException

the invalid request exception

InvalidOperationException

if any other error occurred during the operation