public class UserCredentials extends GoogleCredentials
OAuth2Credentials.CredentialsChangedListener| Constructor and Description |
|---|
UserCredentials(String clientId,
String clientSecret,
String refreshToken)
Constructor with minimum information and default behavior.
|
UserCredentials(String clientId,
String clientSecret,
String refreshToken,
AccessToken accessToken)
Constructor to allow both refresh token and initial access token for 3LO scenarios.
|
UserCredentials(String clientId,
String clientSecret,
String refreshToken,
AccessToken accessToken,
HttpTransportFactory transportFactory,
URI tokenServerUri)
Constructor with all parameters allowing custom transport and server URL.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static UserCredentials |
fromStream(InputStream credentialsStream)
Returns credentials defined by a JSON file stream using the format supported by the Cloud SDK.
|
static UserCredentials |
fromStream(InputStream credentialsStream,
HttpTransportFactory transportFactory)
Returns credentials defined by a JSON file stream using the format supported by the Cloud SDK.
|
String |
getClientId()
Returns client ID of the credential from the console.
|
String |
getClientSecret()
Returns client secret of the credential from the console.
|
String |
getRefreshToken()
Returns the refresh token resulting from a OAuth2 consent flow.
|
int |
hashCode() |
AccessToken |
refreshAccessToken()
Refreshes the OAuth2 access token by getting a new access token from the refresh token
|
String |
toString() |
createDelegated, createScoped, createScopedRequired, getApplicationDefault, getApplicationDefaultaddChangeListener, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadata, getRequestMetadata, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, toStringHelperblockingGetToCallback, getRequestMetadatapublic UserCredentials(String clientId, String clientSecret, String refreshToken)
clientId - Client ID of the credential from the console.clientSecret - Client ID of the credential from the console.refreshToken - A refresh token resulting from a OAuth2 consent flow.public UserCredentials(String clientId, String clientSecret, String refreshToken, AccessToken accessToken)
clientId - Client ID of the credential from the console.clientSecret - Client ID of the credential from the console.refreshToken - A refresh token resulting from a OAuth2 consent flow.accessToken - Initial or temporary access token.public UserCredentials(String clientId, String clientSecret, String refreshToken, AccessToken accessToken, HttpTransportFactory transportFactory, URI tokenServerUri)
clientId - Client ID of the credential from the console.clientSecret - Client ID of the credential from the console.refreshToken - A refresh token resulting from a OAuth2 consent flow.accessToken - Initial or temporary access token.transportFactory - HTTP transport factory, creates the transport used to get access
tokens.tokenServerUri - URI of the end point that provides tokens.public static UserCredentials fromStream(InputStream credentialsStream) throws IOException
credentialsStream - the stream with the credential definition.IOException - if the credential cannot be created from the stream.public static UserCredentials fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory) throws IOException
credentialsStream - the stream with the credential definition.transportFactory - HTTP transport factory, creates the transport used to get access
tokens.IOException - if the credential cannot be created from the stream.public AccessToken refreshAccessToken() throws IOException
refreshAccessToken in class OAuth2CredentialsIOException - from derived implementationspublic final String getClientId()
public final String getClientSecret()
public final String getRefreshToken()
public int hashCode()
hashCode in class OAuth2Credentialspublic String toString()
toString in class OAuth2Credentialspublic boolean equals(Object obj)
equals in class OAuth2CredentialsCopyright © 2017 Google. All rights reserved.