[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Class StoredCredential (1.39.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.39.0 (latest)](/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.StoredCredential)\n- [1.38.2](/java/docs/reference/google-oauth-client/1.38.2/com.google.api.client.auth.oauth2.StoredCredential)\n- [1.37.0](/java/docs/reference/google-oauth-client/1.37.0/com.google.api.client.auth.oauth2.StoredCredential)\n- [1.36.0](/java/docs/reference/google-oauth-client/1.36.0/com.google.api.client.auth.oauth2.StoredCredential)\n- [1.34.1](/java/docs/reference/google-oauth-client/1.34.1/com.google.api.client.auth.oauth2.StoredCredential)\n- [1.33.3](/java/docs/reference/google-oauth-client/1.33.3/com.google.api.client.auth.oauth2.StoredCredential)\n- [1.32.1](/java/docs/reference/google-oauth-client/1.32.1/com.google.api.client.auth.oauth2.StoredCredential) \n\n public final class StoredCredential implements Serializable\n\nBeta \n\nCredential information to be stored in a DataStoreFactory.\n\nImplementation is thread safe. \n\nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e StoredCredential \n\nImplements\n----------\n\n[Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html) \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Fields\n-------------\n\n### DEFAULT_DATA_STORE_ID\n\n public static final String DEFAULT_DATA_STORE_ID\n\nDefault data store ID.\n\nStatic Methods\n--------------\n\n### getDefaultDataStore(DataStoreFactory dataStoreFactory)\n\n public static DataStore\u003cStoredCredential\u003e getDefaultDataStore(DataStoreFactory dataStoreFactory)\n\nReturns the stored credential data store using the ID [#DEFAULT_DATA_STORE_ID](/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.StoredCredential#com_google_api_client_auth_oauth2_StoredCredential_DEFAULT_DATA_STORE_ID).\n\nConstructors\n------------\n\n### StoredCredential()\n\n public StoredCredential()\n\n### StoredCredential(Credential credential)\n\n public StoredCredential(Credential credential)\n\nMethods\n-------\n\n### equals(Object other)\n\n public boolean equals(Object other)\n\n**Overrides** \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)\n\n### getAccessToken()\n\n public String getAccessToken()\n\nReturns the access token or `null` for none.\n\n### getExpirationTimeMilliseconds()\n\n public Long getExpirationTimeMilliseconds()\n\nReturns the expected expiration time in milliseconds or `null` for none.\n\n### getRefreshToken()\n\n public String getRefreshToken()\n\nReturns the refresh token or `null` for none.\n\n### hashCode()\n\n public int hashCode()\n\n**Overrides** \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)\n\n### setAccessToken(String accessToken)\n\n public StoredCredential setAccessToken(String accessToken)\n\nSets the access token or `null` for none.\n\n### setExpirationTimeMilliseconds(Long expirationTimeMilliseconds)\n\n public StoredCredential setExpirationTimeMilliseconds(Long expirationTimeMilliseconds)\n\nSets the expected expiration time in milliseconds or `null` for none.\n\n### setRefreshToken(String refreshToken)\n\n public StoredCredential setRefreshToken(String refreshToken)\n\nSets the refresh token or `null` for none.\n\n### toString()\n\n public String toString()\n\n**Overrides** \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)"]]