# Class FileCredentialStore (1.39.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.39.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore)
- [1.38.2](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.38.2/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore)
- [1.37.0](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.37.0/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore)
- [1.36.0](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.36.0/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore)
- [1.34.1](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.34.1/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore)
- [1.33.3](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.33.3/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore)
- [1.32.1](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.32.1/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore)

    public class FileCredentialStore implements CredentialStore

**Deprecated.** *(to be removed in the future) Use FileDataStoreFactory with [StoredCredential](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.StoredCredential) instead, optionally using [#migrateTo(FileDataStoreFactory)](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore#com_google_api_client_extensions_java6_auth_oauth2_FileCredentialStore_migrateTo_com_google_api_client_util_store_FileDataStoreFactory_) or
[#migrateTo(DataStore)](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore#com_google_api_client_extensions_java6_auth_oauth2_FileCredentialStore_migrateTo_com_google_api_client_util_store_DataStore_com_google_api_client_auth_oauth2_StoredCredential__) to migrating an existing [FileCredentialStore](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore).*

Beta   

Thread-safe file implementation of a credential store.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> FileCredentialStore

## Implements

[CredentialStore](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.CredentialStore)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### FileCredentialStore(File file, JsonFactory jsonFactory) (deprecated)

    public FileCredentialStore(File file, JsonFactory jsonFactory)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `file` | `https://docs.oracle.com/javase/8/docs/api/java/io/File.html` File to store user credentials |
| `jsonFactory` | `com.google.api.client.json.JsonFactory` JSON factory to serialize user credentials |

## Methods

### delete(String userId, Credential credential) (deprecated)

    public void delete(String userId, Credential credential)

Deletes the credential of the given user ID.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `userId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `credential` | `https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.Credential` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### isSymbolicLink(File file) (deprecated)

    protected boolean isSymbolicLink(File file)

Returns whether the given file is a symbolic link.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `file` | `https://docs.oracle.com/javase/8/docs/api/java/io/File.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### load(String userId, Credential credential) (deprecated)

    public boolean load(String userId, Credential credential)

Loads the credential for the given user ID.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `userId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `credential` | `https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.Credential` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### migrateTo(DataStore\<StoredCredential\> credentialDataStore) (deprecated)

    public final void migrateTo(DataStore<StoredCredential> credentialDataStore)

Migrates to the new format using DataStore of [StoredCredential](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.StoredCredential).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `credentialDataStore` | `com.google.api.client.util.store.DataStore<https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.StoredCredential>` credential data store |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### migrateTo(FileDataStoreFactory dataStoreFactory) (deprecated)

    public final void migrateTo(FileDataStoreFactory dataStoreFactory)

Migrates to the new FileDataStoreFactory format.

Sample usage:


     public static FileDataStore migrate(FileCredentialStore credentialStore, File dataDirectory)
     throws IOException {
     FileDataStore dataStore = new FileDataStore(dataDirectory);
     credentialStore.migrateTo(dataStore);
     return dataStore;
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `dataStoreFactory` | `com.google.api.client.util.store.FileDataStoreFactory` file data store factory |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### store(String userId, Credential credential) (deprecated)

    public void store(String userId, Credential credential)

Stores the credential of the given user ID.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `userId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `credential` | `https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.Credential` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |