windows credential file path resolution fix
This commit is contained in:
parent
4b9e267b7f
commit
c701fe7dea
1 changed files with 3 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ import {
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { google } from "googleapis";
|
import { google } from "googleapis";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const drive = google.drive("v3");
|
const drive = google.drive("v3");
|
||||||
|
|
||||||
|
|
@ -176,7 +177,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join(
|
const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join(
|
||||||
path.dirname(new URL(import.meta.url).pathname),
|
path.dirname(fileURLToPath(import.meta.url)),
|
||||||
"../../../.gdrive-server-credentials.json",
|
"../../../.gdrive-server-credentials.json",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -184,7 +185,7 @@ async function authenticateAndSaveCredentials() {
|
||||||
console.log("Launching auth flow…");
|
console.log("Launching auth flow…");
|
||||||
const auth = await authenticate({
|
const auth = await authenticate({
|
||||||
keyfilePath: process.env.GDRIVE_OAUTH_PATH || path.join(
|
keyfilePath: process.env.GDRIVE_OAUTH_PATH || path.join(
|
||||||
path.dirname(new URL(import.meta.url).pathname),
|
path.dirname(fileURLToPath(import.meta.url)),
|
||||||
"../../../gcp-oauth.keys.json",
|
"../../../gcp-oauth.keys.json",
|
||||||
),
|
),
|
||||||
scopes: ["https://www.googleapis.com/auth/drive.readonly"],
|
scopes: ["https://www.googleapis.com/auth/drive.readonly"],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue