# Google Drive
Back up your end users device's key shares to Google Drive.
This is how you set up Google Drive backups in your app. The first five steps are for all apps - both on Android and iOS.
## Create a Google app
To enable Google Drive backups, first create a Google Project within your organization that will act as the OAuth consumer.
1. Create a new Google project in the [Google Cloud Console](https://console.cloud.google.com/).
2. In the [APIs & Services](https://console.cloud.google.com/apis) page, click **ENABLE APIS AND SERVICES**.
3. Search for Google Drive API, select it, and click **Enable**.
4. Click the OAuth consent screen.
- For user type, select **internal**.
- Provide the relevant information.
(Skip **scopes**.)
5. Click **Credentials** in the left menu and select **Create Credentials**.
### Continue for Android apps
1. Select **OAuth client ID** and choose **Android** in the **Application Type** list.
2. Provide details in the form, as instructed, with Name, Package name, and SHA-1 from your Keystore.
Note that when testing, it's recommended to use your `debug.keystore` at `/android/app/debug.keystore`. However, you'll need to switch this value when pushing it to the store.
3. Find the Sha-1 fingerprint with this command from the root project folder:
`keytool -keystore ./app/debug.keystore -list -v`
4. Once you have successfully created your Android Client ID , download the JSON, and rename it to `google-service.json`.
5. Move the downloaded file into the `/android/app` directory.
6. Add emails for internal testing until you've published your app for external use.
7. Add dependencies to the following Fordefi SDKs into package.json:
```javascript
npm i @fordefi/wallet-sdk-react-native
npm i @fordefi/backup-provider-react-native
```
8. Into your `android/app/build.gradle` add the following dependencies:
```javascript
dependencies{
...
implementation 'com.google.android.gms:play-services-auth:20.7.0'
implementation('com.google.api-client:google-api-client-android:2.2.0') {
exclude group: 'org.apache.httpcomponents'
exclude module: 'guava-jdk5'
}
implementation('com.google.apis:google-api-services-drive:v3-rev20230822-2.0.0') {
exclude group: 'org.apache.httpcomponents'
exclude module: 'guava-jdk5'
}
implementation('com.google.api-client:google-api-client-android:2.2.0'){
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev197-1.25.0') {
exclude group: 'org.apache.httpcomponents'
}
}
```
9. Using in a React Native project:
```javascript
import {
backupKeyset,
CloudBackupOptions,
BackupProvider,
} from '@fordefi/wallet-sdk-react-native';
import {
initBackupProvider,
BackupConfiguration,
} from '@fordefi/backup-provider-react-native';
```
10. Call to init BackupProvider:
```javascript
await initBackupProvider(null)
```
11. Call backup with Google Drive backup option:
```javascript
const backupOptions: CloudBackupOptions = {
backupProvider: BackupProvider.GoogleDrive,
};
const result = await backupKeyset(keysetId, backupOptions);
```
### Continue for iOS apps
1. Select **OAuth client ID** and choose **iOS** in the **Application Type** list.
2. Get your **Bundle ID** from the React Native or iOS project.
3. Once you've successfully created your iOS client ID, download the `.plist` configuration and copy the `REVERSED_CLIENT_ID` to the URL Scheme section of your `info.plist` - either in Xcode or your IDE:
```javascript
...
CFBundleURLTypes
CFBundleTypeRole
Editor
CFBundleURLSchemes
REVERSE_CLIENT_ID
...
```
4. Rename the downloaded `.plist` file to `GoogleService-Info.plist` and save it to your `/ios` directory.
5. Set up in the project:
```javascript
plugin 'cocoapods-user-defined-build-types'
enable_user_defined_build_types!
pod 'GoogleSignIn', '7.0.0', :build_type => :dynamic_framework
pod 'GoogleAPIClientForREST/Drive', '3.1.0', :build_type => :dynamic_framework
```
6. After adding new dependencies, remove the `pods` folder and `node_modules` and run:
```javascript
sudo gem install cocoapods-user-defined-
build-types
```
7. Then run:
```javascript
pod install --repo-update
```
8. Using in the React Native project:
```javascript
import {
backupKeyset,
FordefiSdkErrorResult,
FordefiSdkConfiguration,
CloudBackupOptions,
BackupProvider,
} from '@fordefi/wallet-sdk-react-native';
import {
initBackupProvider,
BackupConfiguration,
} from '@fordefi/backup-provider-react-native';
```
9. Register your `GOOGLE_DRIVE_IOS_CLIENT_ID` in the `BackupConfiguration` function and call to `init BackupProvider`:
```javascript
const config: BackupConfiguration = {
googleDriveClientID: Config.GOOGLE_DRIVE_IOS_CLIENT_ID,
};
await initBackupProvider(config)
```
10. Call backup with Google Drive backup option:
```javascript
const backupOptions: CloudBackupOptions = {
backupProvider: BackupProvider.GoogleDrive,
};
const result = await backupKeyset(keysetId, backupOptions);
```