getGoogleDriveBackupReadiness is a pre-flight check that tells you whether the user’s linked Google account has the OAuth scopes required to back up MPC key shares to Google Drive. Use it to detect — and recover from — missing-scope situations before triggering an MPC reshare ceremony, so you don’t burn a ceremony on an upload that will fail.
It pairs with the Google Drive backup setup as the first layer of a two-layer defense: pre-flight readiness (this function) catches the common cases; post-flight error inspection (via isInsufficientGoogleDriveScopesError) handles legacy tokens captured before scope tracking was introduced.
Usage
Parameters
Returns
Promise<GoogleDriveBackupReadiness> — resolves to the readiness result.
Failures of the underlying access-token fetch propagate as Promise rejections — the caller is expected to surface or retry them.
GoogleDriveBackupReadiness
The
'needs-access' status covers three distinct sub-cases, distinguishable by missingScopes:
Recovering from 'needs-access'
Recovery is the caller’s responsibility — re-link the user’s Google account so the required Drive scopes are granted, then call getGoogleDriveBackupReadiness again before retrying the backup. Use signInWithSocialRedirect with the google provider:
Examples
Pre-flight check before backup
- JavaScript
- React
Post-flight scope-error recovery
For legacy tokens where pre-flight cannot prove the upload will fail (missingScopes is empty under 'needs-access', or stored scopes were never recorded), wrap the backup attempt in a try/catch and use isInsufficientGoogleDriveScopesError to detect the scope-denied failure mode.