public class UserCredentials extends GoogleCredentials
| Modifier and Type | Class and Description |
|---|---|
static class |
UserCredentials.Builder |
OAuth2Credentials.CredentialsChangedListener| Constructor and Description |
|---|
UserCredentials(String clientId,
String clientSecret,
String refreshToken)
Deprecated.
Use
newBuilder() instead. This constructor will either be deleted or made
private in a later version. |
UserCredentials(String clientId,
String clientSecret,
String refreshToken,
AccessToken accessToken)
Deprecated.
Use
newBuilder() instead. This constructor will either be deleted or made
private in a later version. |
UserCredentials(String clientId,
String clientSecret,
String refreshToken,
AccessToken accessToken,
HttpTransportFactory transportFactory,
URI tokenServerUri)
Deprecated.
Use
newBuilder() instead. This constructor will either be deleted or made
private in a later version. |
| 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() |
static UserCredentials.Builder |
newBuilder() |
AccessToken |
refreshAccessToken()
Refreshes the OAuth2 access token by getting a new access token from the refresh token
|
void |
save(String filePath)
Saves the end user credentials into the given file path.
|
UserCredentials.Builder |
toBuilder() |
String |
toString() |
create, createDelegated, createScoped, createScopedRequired, getApplicationDefault, getApplicationDefault, ofaddChangeListener, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadata, getRequestMetadata, getRequestMetadataInternal, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, removeChangeListenerblockingGetToCallback, getRequestMetadata@Deprecated public UserCredentials(String clientId, String clientSecret, String refreshToken)
newBuilder() instead. This constructor will either be deleted or made
private in a later version.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.@Deprecated public UserCredentials(String clientId, String clientSecret, String refreshToken, AccessToken accessToken)
newBuilder() instead. This constructor will either be deleted or made
private in a later version.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.@Deprecated public UserCredentials(String clientId, String clientSecret, String refreshToken, AccessToken accessToken, HttpTransportFactory transportFactory, URI tokenServerUri)
newBuilder() instead. This constructor will either be deleted or made
private in a later version.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 void save(String filePath) throws IOException
filePath - Path to file where to store the credentialsIOException - An error storing the credentials.public int hashCode()
hashCode in class OAuth2Credentialspublic String toString()
toString in class OAuth2Credentialspublic boolean equals(Object obj)
equals in class OAuth2Credentialspublic static UserCredentials.Builder newBuilder()
public UserCredentials.Builder toBuilder()
toBuilder in class GoogleCredentialsCopyright © 2017 Google. All rights reserved.