aboutsummaryrefslogtreecommitdiff
path: root/src/server/apis
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-06-19 15:34:13 -0400
committerbobzel <zzzman@gmail.com>2025-06-19 15:34:13 -0400
commit21fb3a555cdd861452e2e54de3d0524e29f2bc08 (patch)
tree44b93ba0b4f9a85dafdb744ccb11dfe3386f4829 /src/server/apis
parentabdfe5b109f42cd5da4aceef1bd667c8e1f6cbbd (diff)
parent765c7a3870a1d446622a28b157ab00a4dced2879 (diff)
Merge branch 'task_nodes_aarav'
Diffstat (limited to 'src/server/apis')
-rw-r--r--src/server/apis/google/GoogleApiServerUtils.ts11
-rw-r--r--src/server/apis/google/google_project_credentials.json8
2 files changed, 10 insertions, 9 deletions
diff --git a/src/server/apis/google/GoogleApiServerUtils.ts b/src/server/apis/google/GoogleApiServerUtils.ts
index 7373df473..ad0f0e580 100644
--- a/src/server/apis/google/GoogleApiServerUtils.ts
+++ b/src/server/apis/google/GoogleApiServerUtils.ts
@@ -13,7 +13,7 @@ import { GoogleCredentialsLoader } from './CredentialsLoader';
* This is the somewhat overkill list of what Dash requests
* from the user.
*/
-const scope = ['documents.readonly', 'documents', 'presentations', 'presentations.readonly', 'drive', 'drive.file', 'photoslibrary', 'photoslibrary.appendonly', 'photoslibrary.sharing', 'userinfo.profile'].map(
+const scope = ['tasks', 'documents.readonly', 'documents', 'presentations', 'presentations.readonly', 'drive', 'drive.file', 'photoslibrary', 'photoslibrary.appendonly', 'photoslibrary.sharing', 'userinfo.profile'].map(
relative => `https://www.googleapis.com/auth/${relative}`
);
@@ -181,7 +181,7 @@ export namespace GoogleApiServerUtils {
* @returns the newly generated url to the authentication landing page
*/
export function generateAuthenticationUrl(): string {
- return worker.generateAuthUrl({ scope, access_type: 'offline' });
+ return worker.generateAuthUrl({ scope, access_type: 'offline', prompt: 'consent' });
}
/**
@@ -203,12 +203,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);
@@ -304,6 +304,7 @@ export namespace GoogleApiServerUtils {
const { access_token, expires_in } = await new Promise<{ access_token: string; expires_in: number }>(resolve => {
request.post(url, headerParameters).then(response => resolve(JSON.parse(response)));
});
+
// expires_in is in seconds, but we're building the new expiry date in milliseconds
const expiry_date = new Date().getTime() + expires_in * 1000;
await Database.Auxiliary.GoogleAccessToken.Update(userId, access_token, expiry_date);
diff --git a/src/server/apis/google/google_project_credentials.json b/src/server/apis/google/google_project_credentials.json
index 955c5a3c1..438e5157e 100644
--- a/src/server/apis/google/google_project_credentials.json
+++ b/src/server/apis/google/google_project_credentials.json
@@ -1,11 +1,11 @@
{
"installed": {
- "client_id": "343179513178-ud6tvmh275r2fq93u9eesrnc66t6akh9.apps.googleusercontent.com",
- "project_id": "quickstart-1565056383187",
+ "client_id": "740987818053-dtflji3hfkn5r9t8ad6jb8740pls8moh.apps.googleusercontent.com",
+ "project_id": "dash-web-461920",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
- "client_secret": "w8KIFSc0MQpmUYHed4qEzn8b",
- "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
+ "client_secret": "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",
+ "redirect_uris": ["http://localhost:1050/refreshGoogle"]
}
} \ No newline at end of file