Interface OAuthFlow


  • public interface OAuthFlow

    OAuthFlow interface provides methods to do the OAuth2 authorization.

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

    • Method Detail

      • newAuthorizationURL

        java.lang.String newAuthorizationURL​(java.util.EnumSet<AccessScope> scopes,
                                             java.lang.String state)

        Generate a new authorization URL.

        Parameters:
        scopes - the requested scopes
        state - 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:
        the authorization URL
        Throws:
        java.lang.IllegalArgumentException - if scopes is null or empty
      • obtainNewToken

        Token obtainNewToken​(AuthorizationResult authorizationResult)
                      throws OAuthTokenException,
                             com.smartsheet.api.internal.json.JSONSerializerException,
                             com.smartsheet.api.internal.http.HttpClientException,
                             java.net.URISyntaxException,
                             InvalidRequestException
        Obtain a new token using AuthorizationResult.
        Parameters:
        authorizationResult - the authorization result
        Returns:
        the token
        Throws:
        OAuthTokenException - the o auth token exception
        com.smartsheet.api.internal.json.JSONSerializerException - the JSON serializer exception
        com.smartsheet.api.internal.http.HttpClientException - the http client exception
        java.net.URISyntaxException - the URI syntax exception
        InvalidRequestException - the invalid request exception
        java.lang.IllegalArgumentException - if any other error occurred during the operation
      • refreshToken

        Token refreshToken​(Token token)
                    throws OAuthTokenException,
                           com.smartsheet.api.internal.json.JSONSerializerException,
                           com.smartsheet.api.internal.http.HttpClientException,
                           java.net.URISyntaxException,
                           InvalidRequestException
        Refresh token.
        Parameters:
        token - the token to refresh
        Returns:
        the refreshed token
        Throws:
        OAuthTokenException - the o auth token exception
        com.smartsheet.api.internal.json.JSONSerializerException - the JSON serializer exception
        com.smartsheet.api.internal.http.HttpClientException - the http client exception
        java.net.URISyntaxException - the URI syntax exception
        InvalidRequestException - the invalid request exception
        java.lang.IllegalArgumentException - if any other error occurred during the operation
      • revokeAccessToken

        void revokeAccessToken​(Token token)
                        throws OAuthTokenException,
                               com.smartsheet.api.internal.json.JSONSerializerException,
                               com.smartsheet.api.internal.http.HttpClientException,
                               java.net.URISyntaxException,
                               InvalidRequestException
        Revoke access token.

        Exceptions: - IllegalArgumentException : if url is null or empty - InvalidTokenRequestException : if the token request is invalid - InvalidOAuthClientException : if the client information is invalid - InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the redirect_uri does not match, or the hash value does not match the client secret and/or code - UnsupportedOAuthGrantTypeException : if the grant type is invalid - OAuthTokenException : if any other error occurred during the operation

        Parameters:
        token - the access token to revoke access from
        Throws:
        OAuthTokenException - the o auth token exception
        com.smartsheet.api.internal.json.JSONSerializerException - the JSON serializer exception
        com.smartsheet.api.internal.http.HttpClientException - the http client exception
        java.net.URISyntaxException - the URI syntax exception
        InvalidRequestException - the invalid request exception