> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# gDriveSignOut

> Clears the stored Google Drive session so the next backup or recovery runs a fresh interactive Google sign-in.

**Function Signature**

```swift theme={null}
public func gDriveSignOut() throws
```

**Throws**

* `MpcError.backupMethodNotRegistered` if the Google Drive backup method has not been registered using `registerBackupMethod`
* `GDriveClientError.authenticationNotInitialized` if `setGDriveConfiguration` has not been called yet

**Notes**

* Requires only `setGDriveConfiguration`. A presenting view (`setGDriveView`) is not needed to sign out.
* Use it to let a user switch Google accounts, or to clear a session you know is stale before the next backup or recovery.
* You do not need to call it when Google revokes or expires the stored sign-in. The SDK detects that case, clears the dead session, and falls back to a fresh interactive sign-in on its own.
* Available starting from SDK version 7.4.0.

**Example Usage**

```swift theme={null}
do {
    try portal.setGDriveConfiguration(
        clientId: "your-google-client-id",
        backupOption: .appDataFolder
    )

    // Clear the stored Google session, for example when the user
    // chooses "Use a different Google account".
    try portal.gDriveSignOut()

    // The next backup or recovery presents the Google sign-in sheet again.
    try portal.setGDriveView(self)
    let (
        encryptedClientBackupShare,
        storageCallback
    ) = try await portal.backupWallet(.GoogleDrive) { status in
        // (Optional) Create a progress indicator here in the progress callback.
    }
} catch {
    print("Error signing out of Google Drive: \(error)")
}
```

**Related Documentation**

* [Google Drive Backup Method](../guide/back-up-a-wallet#google-drive)
* [Google sign-in sessions](../guide/back-up-a-wallet#google-sign-in-sessions)
* [setGDriveConfiguration function reference](./setgdriveconfiguration)
* [Configure GDrive storage](../../../resources/backup-options/gdrive)
