Package twitter4j
Class OAuth2Authorization
java.lang.Object
twitter4j.OAuth2Authorization
- All Implemented Interfaces:
Serializable
,Authorization
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getAuthorizationHeader
(twitter4j.HttpRequest req) static OAuth2Authorization
Equivalent to OAuth2Authorization.newBuilder().build();static OAuth2Authorization
getInstance
(String consumerKey, String consumerSecret) Equivalent to OAuth2Authorization.newBuilder().oAuthConsumer(key, secret).build();Obtains an OAuth 2 Bearer token.int
hashCode()
void
Revokes an issued OAuth 2 Bearer Token.boolean
Returns true if authorization credentials are set.static twitter4j.OAuth2Authorization.OAuth2AuthorizationBuilder
toString()
-
Method Details
-
newBuilder
public static twitter4j.OAuth2Authorization.OAuth2AuthorizationBuilder newBuilder()- Returns:
- builder for
OAuth2Authorization
-
getInstance
Equivalent to OAuth2Authorization.newBuilder().oAuthConsumer(key, secret).build();- Parameters:
consumerKey
- consumer keyconsumerSecret
- consumer secret- Returns:
- OAuth2Authorization
-
getInstance
Equivalent to OAuth2Authorization.newBuilder().build();- Returns:
- OAuth2Authorization
-
getOAuth2Token
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:
-
invalidateOAuth2Token
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.
-
getAuthorizationHeader
- Specified by:
getAuthorizationHeader
in interfaceAuthorization
- Parameters:
req
- request- Returns:
- header
-
isEnabled
public boolean isEnabled()Description copied from interface:Authorization
Returns true if authorization credentials are set.- Specified by:
isEnabled
in interfaceAuthorization
- Returns:
- true if authorization credentials are set
-
equals
-
hashCode
public int hashCode() -
toString
-