twitter4j.auth

## Interface OAuth2Support

All Known Subinterfaces:
  Twitter

All Known Implementing Classes:
  OAuth2Authorization

    public interface OAuth2Support

Author:
  KOMIYA Atsushi - komiya.atsushi at gmail.com
See Also:
  Application-only authentication | Twitter Developers

### Method Summary

All Methods Instance Methods Abstract Methods
`OAuth2Token` `getOAuth2Token()` Obtains an OAuth 2 Bearer token.
`void` `invalidateOAuth2Token()` Revokes an issued OAuth 2 Bearer Token.
`void` `setOAuth2Token(OAuth2Token oauth2Token)` Sets the OAuth 2 Bearer token.
`void` `setOAuthConsumer(String consumerKey, String consumerSecret)` Sets the OAuth consumer key and consumer secret.

### Method Detail

#### setOAuthConsumer

    void setOAuthConsumer(String consumerKey,
                          String consumerSecret)

Sets the OAuth consumer key and consumer secret.

Parameters:
  `consumerKey` - OAuth consumer key
  `consumerSecret` - OAuth consumer secret
Throws:
  `IllegalStateException` - when OAuth consumer has already been set, or the instance is using basic authorization.

#### getOAuth2Token

    OAuth2Token getOAuth2Token()
                        throws TwitterException

Obtains an OAuth 2 Bearer token.

Returns:
  OAuth 2 Bearer token
Throws:
  `TwitterException` - when Twitter service or network is unavailable, or connecting non-SSL endpoints.
  `IllegalStateException` - when Bearer token is already available, or OAuth consumer is not available.
See Also:
  POST oauth2/token | Twitter Developers

#### setOAuth2Token

    void setOAuth2Token(OAuth2Token oauth2Token)

Sets the OAuth 2 Bearer token.

Parameters:
  `oauth2Token` - OAuth 2 Bearer token

#### invalidateOAuth2Token

    void invalidateOAuth2Token()
                        throws TwitterException

Revokes an issued OAuth 2 Bearer Token.

Throws:
  `TwitterException` - when Twitter service or network is unavailable, or connecting non-SSL endpoints.
  `IllegalStateException` - when Bearer token is not available.