MCPcopy
hub / github.com/21st-dev/1code / refreshGoogle

Method refreshGoogle

src/main/lib/credential-manager.ts:628–650  ·  view source on GitHub ↗

* Refresh Google OAuth token

(
    source: LoadedSource,
    cred: StoredCredential
  )

Source from the content-addressed store, hash-verified

626 * Refresh Google OAuth token
627 */
628 private async refreshGoogle(
629 source: LoadedSource,
630 cred: StoredCredential
631 ): Promise<string | null> {
632 try {
633 const result = await refreshGoogleToken(cred.refreshToken!);
634
635 // Update stored credentials
636 await this.save(source, {
637 ...cred,
638 value: result.accessToken,
639 expiresAt: result.expiresAt,
640 });
641
642 debug(`[SourceCredentialManager] Refreshed Google token for ${source.config.slug}`);
643 return result.accessToken;
644 } catch (error) {
645 const errorMsg = error instanceof Error ? error.message : String(error);
646 debug(`[SourceCredentialManager] Google token refresh failed:`, error);
647 this.markSourceNeedsReauth(source, `Token refresh failed: ${errorMsg}`);
648 return null;
649 }
650 }
651
652 /**
653 * Refresh Slack OAuth token

Callers 1

refreshMethod · 0.95

Calls 2

saveMethod · 0.95
markSourceNeedsReauthMethod · 0.95

Tested by

no test coverage detected