diff options
author | bobzel <zzzman@gmail.com> | 2025-06-04 21:05:03 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-06-04 21:05:03 -0400 |
commit | 8d424c8cb4d178d5fb92b6543d63fa409eb6430b (patch) | |
tree | a2b34b3e161b316403956d7407df7d2afe27546c /src/server/apis/google/GoogleApiServerUtils.ts | |
parent | 09be9002b5aa8f5ad7c602bcef6b53bbe0398cd3 (diff) |
changed google authentication to not reload the page.
Diffstat (limited to 'src/server/apis/google/GoogleApiServerUtils.ts')
-rw-r--r-- | src/server/apis/google/GoogleApiServerUtils.ts | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/server/apis/google/GoogleApiServerUtils.ts b/src/server/apis/google/GoogleApiServerUtils.ts index 56bc79119..2f7ef473c 100644 --- a/src/server/apis/google/GoogleApiServerUtils.ts +++ b/src/server/apis/google/GoogleApiServerUtils.ts @@ -185,18 +185,14 @@ export namespace GoogleApiServerUtils { */ export function generateAuthenticationUrl(): string { const oauth2Client = new google.auth.OAuth2( - '838617994486-a28072lirm8uk8cm78t7ic4krp0rgkgv.apps.googleusercontent.com', - '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', + '740987818053-dtflji3hfkn5r9t8ad6jb8740pls8moh.apps.googleusercontent.com', + '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', 'http://localhost:1050/refreshGoogle' // Ensure this matches the redirect URI in Google Cloud Console ); return oauth2Client.generateAuthUrl({ access_type: 'offline', - scope: [ - 'https://www.googleapis.com/auth/tasks', - 'openid', - 'profile' - ], + scope: ['https://www.googleapis.com/auth/tasks', 'openid', 'profile'], prompt: 'consent', // This ensures we get a refresh token }); } @@ -220,12 +216,12 @@ export namespace GoogleApiServerUtils { */ export async function processNewUser(userId: string, authenticationCode: string): Promise<EnrichedCredentials> { const credentials = await new Promise<Credentials>((resolve, reject) => { - worker.getToken(authenticationCode, (err, credentials) => { - if (err || !credentials) { + worker.getToken(authenticationCode, (err, creds) => { + if (err || !creds) { reject(err); return; } - resolve(credentials); + resolve(creds); }); }); const enriched = injectUserInfo(credentials); |