MCPcopy
hub / github.com/CapSoftware/Cap / getGoogleDriveAuthUrl

Function getGoogleDriveAuthUrl

packages/web-backend/src/Storage/GoogleDrive.ts:158–176  ·  view source on GitHub ↗
({ state }: { state: string })

Source from the content-addressed store, hash-verified

156 );
157
158export const getGoogleDriveAuthUrl = ({ state }: { state: string }) => {
159 const env = serverEnv();
160 if (!env.GOOGLE_CLIENT_ID) {
161 throw new Error("GOOGLE_CLIENT_ID is not configured");
162 }
163
164 const params = new URLSearchParams({
165 client_id: env.GOOGLE_CLIENT_ID,
166 redirect_uri: `${env.WEB_URL}/api/desktop/storage/google-drive/callback`,
167 response_type: "code",
168 access_type: "offline",
169 prompt: "consent",
170 scope: DRIVE_FILE_SCOPE,
171 state,
172 include_granted_scopes: "true",
173 });
174
175 return `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;
176};
177
178export const exchangeGoogleDriveCode = (code: string) =>
179 Effect.tryPromise({

Callers 2

storage.tsFile · 0.90

Calls 1

serverEnvFunction · 0.90

Tested by

no test coverage detected