aboutsummaryrefslogtreecommitdiff
path: root/src/server/apis/google/GoogleApiServerUtils.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-05-14 16:33:44 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-05-14 16:33:44 -0400
commitb9440e34d89b28acacdd6eed2cda39cd2a1d8c46 (patch)
tree9d7c91a4f6ebf7270bbc66180cadbb592dac40a7 /src/server/apis/google/GoogleApiServerUtils.ts
parentf6a55c0d613787f60e4a40b728a1acbc6c39c552 (diff)
parente31ec0a7d4fe9772f1e52081717e53e0fdf9fb9b (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/server/apis/google/GoogleApiServerUtils.ts')
-rw-r--r--src/server/apis/google/GoogleApiServerUtils.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/server/apis/google/GoogleApiServerUtils.ts b/src/server/apis/google/GoogleApiServerUtils.ts
index 48a8da89f..2e4811c86 100644
--- a/src/server/apis/google/GoogleApiServerUtils.ts
+++ b/src/server/apis/google/GoogleApiServerUtils.ts
@@ -3,9 +3,9 @@ import { OAuth2Client, Credentials, OAuth2ClientOptions } from "google-auth-libr
import { Opt } from "../../../new_fields/Doc";
import { GaxiosResponse } from "gaxios";
import request = require('request-promise');
-import * as qs from 'query-string';
+import * as qs from "query-string";
import { Database } from "../../database";
-import { GoogleCredentialsLoader } from "../../credentials/CredentialsLoader";
+import { GoogleCredentialsLoader } from "./CredentialsLoader";
/**
* Scopes give Google users fine granularity of control
@@ -224,7 +224,7 @@ export namespace GoogleApiServerUtils {
});
});
const enriched = injectUserInfo(credentials);
- await Database.Auxiliary.GoogleAuthenticationToken.Write(userId, enriched);
+ await Database.Auxiliary.GoogleAccessToken.Write(userId, enriched);
return enriched;
}
@@ -280,7 +280,7 @@ export namespace GoogleApiServerUtils {
* and a flag indicating whether or not they were refreshed during retrieval
*/
export async function retrieveCredentials(userId: string): Promise<{ credentials: Opt<EnrichedCredentials>, refreshed: boolean }> {
- let credentials = await Database.Auxiliary.GoogleAuthenticationToken.Fetch(userId);
+ let credentials = await Database.Auxiliary.GoogleAccessToken.Fetch(userId);
let refreshed = false;
if (!credentials) {
return { credentials: undefined, refreshed };
@@ -318,7 +318,7 @@ export namespace GoogleApiServerUtils {
});
// 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.GoogleAuthenticationToken.Update(userId, access_token, expiry_date);
+ await Database.Auxiliary.GoogleAccessToken.Update(userId, access_token, expiry_date);
// update the relevant properties
credentials.access_token = access_token;
credentials.expiry_date = expiry_date;