@auxcode/auxta 1.3.19-beta.3 → 1.3.19-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/macros/helpers/GoogleAuthHelper.d.ts +6 -6
- package/build/cjs/macros/helpers/GoogleAuthHelper.js +18 -16
- package/build/esm/macros/helpers/GoogleAuthHelper.d.ts +6 -6
- package/build/esm/macros/helpers/GoogleAuthHelper.js +18 -16
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare class GoogleAuthHelper {
|
|
2
|
-
private
|
|
3
|
-
private
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
private
|
|
7
|
-
private
|
|
2
|
+
private _oAuth2Client;
|
|
3
|
+
private credentialsJson;
|
|
4
|
+
get oAuth2Client(): any;
|
|
5
|
+
setup(): Promise<void>;
|
|
6
|
+
private authorize;
|
|
7
|
+
private getNewToken;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: GoogleAuthHelper;
|
|
10
10
|
export default _default;
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.GoogleAuthHelper = void 0;
|
|
13
13
|
const fs = require('fs');
|
|
14
14
|
const readline = require('readline');
|
|
15
|
-
const { google } = require(
|
|
15
|
+
const { google } = require("googleapis");
|
|
16
16
|
const SCOPES = [
|
|
17
17
|
'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
|
|
18
18
|
'https://www.googleapis.com/auth/gmail.addons.current.message.action',
|
|
@@ -29,15 +29,28 @@ const SCOPES = [
|
|
|
29
29
|
];
|
|
30
30
|
const TOKEN_PATH = 'token.json';
|
|
31
31
|
class GoogleAuthHelper {
|
|
32
|
-
|
|
32
|
+
constructor() {
|
|
33
|
+
this.credentialsJson = {
|
|
34
|
+
"installed": {
|
|
35
|
+
"client_id": "120362272213-usevfijf76jj5nsr502i2lai6nu71oq8.apps.googleusercontent.com",
|
|
36
|
+
"project_id": "auxta-library",
|
|
37
|
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
38
|
+
"token_uri": "https://oauth2.googleapis.com/token",
|
|
39
|
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
40
|
+
"client_secret": "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",
|
|
41
|
+
"redirect_uris": ["https://auxcode.com"]
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
get oAuth2Client() {
|
|
33
46
|
return this._oAuth2Client;
|
|
34
47
|
}
|
|
35
|
-
|
|
48
|
+
setup() {
|
|
36
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
50
|
yield this.authorize(this.credentialsJson);
|
|
38
51
|
});
|
|
39
52
|
}
|
|
40
|
-
|
|
53
|
+
authorize(credentials) {
|
|
41
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
55
|
const { client_secret, client_id, redirect_uris } = credentials.installed;
|
|
43
56
|
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
|
|
@@ -55,7 +68,7 @@ class GoogleAuthHelper {
|
|
|
55
68
|
}
|
|
56
69
|
});
|
|
57
70
|
}
|
|
58
|
-
|
|
71
|
+
getNewToken(oAuth2Client) {
|
|
59
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
73
|
const authUrl = oAuth2Client.generateAuthUrl({
|
|
61
74
|
access_type: 'offline',
|
|
@@ -85,15 +98,4 @@ class GoogleAuthHelper {
|
|
|
85
98
|
}
|
|
86
99
|
}
|
|
87
100
|
exports.GoogleAuthHelper = GoogleAuthHelper;
|
|
88
|
-
GoogleAuthHelper.credentialsJson = {
|
|
89
|
-
"installed": {
|
|
90
|
-
"client_id": "120362272213-usevfijf76jj5nsr502i2lai6nu71oq8.apps.googleusercontent.com",
|
|
91
|
-
"project_id": "auxta-library",
|
|
92
|
-
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
93
|
-
"token_uri": "https://oauth2.googleapis.com/token",
|
|
94
|
-
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
95
|
-
"client_secret": "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",
|
|
96
|
-
"redirect_uris": ["https://auxcode.com"]
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
101
|
exports.default = new GoogleAuthHelper();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare class GoogleAuthHelper {
|
|
2
|
-
private
|
|
3
|
-
private
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
private
|
|
7
|
-
private
|
|
2
|
+
private _oAuth2Client;
|
|
3
|
+
private credentialsJson;
|
|
4
|
+
get oAuth2Client(): any;
|
|
5
|
+
setup(): Promise<void>;
|
|
6
|
+
private authorize;
|
|
7
|
+
private getNewToken;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: GoogleAuthHelper;
|
|
10
10
|
export default _default;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
const readline = require('readline');
|
|
12
|
-
const { google } = require(
|
|
12
|
+
const { google } = require("googleapis");
|
|
13
13
|
const SCOPES = [
|
|
14
14
|
'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
|
|
15
15
|
'https://www.googleapis.com/auth/gmail.addons.current.message.action',
|
|
@@ -26,15 +26,28 @@ const SCOPES = [
|
|
|
26
26
|
];
|
|
27
27
|
const TOKEN_PATH = 'token.json';
|
|
28
28
|
export class GoogleAuthHelper {
|
|
29
|
-
|
|
29
|
+
constructor() {
|
|
30
|
+
this.credentialsJson = {
|
|
31
|
+
"installed": {
|
|
32
|
+
"client_id": "120362272213-usevfijf76jj5nsr502i2lai6nu71oq8.apps.googleusercontent.com",
|
|
33
|
+
"project_id": "auxta-library",
|
|
34
|
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
35
|
+
"token_uri": "https://oauth2.googleapis.com/token",
|
|
36
|
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
37
|
+
"client_secret": "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",
|
|
38
|
+
"redirect_uris": ["https://auxcode.com"]
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
get oAuth2Client() {
|
|
30
43
|
return this._oAuth2Client;
|
|
31
44
|
}
|
|
32
|
-
|
|
45
|
+
setup() {
|
|
33
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
47
|
yield this.authorize(this.credentialsJson);
|
|
35
48
|
});
|
|
36
49
|
}
|
|
37
|
-
|
|
50
|
+
authorize(credentials) {
|
|
38
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
52
|
const { client_secret, client_id, redirect_uris } = credentials.installed;
|
|
40
53
|
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
|
|
@@ -52,7 +65,7 @@ export class GoogleAuthHelper {
|
|
|
52
65
|
}
|
|
53
66
|
});
|
|
54
67
|
}
|
|
55
|
-
|
|
68
|
+
getNewToken(oAuth2Client) {
|
|
56
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
70
|
const authUrl = oAuth2Client.generateAuthUrl({
|
|
58
71
|
access_type: 'offline',
|
|
@@ -81,15 +94,4 @@ export class GoogleAuthHelper {
|
|
|
81
94
|
});
|
|
82
95
|
}
|
|
83
96
|
}
|
|
84
|
-
GoogleAuthHelper.credentialsJson = {
|
|
85
|
-
"installed": {
|
|
86
|
-
"client_id": "120362272213-usevfijf76jj5nsr502i2lai6nu71oq8.apps.googleusercontent.com",
|
|
87
|
-
"project_id": "auxta-library",
|
|
88
|
-
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
89
|
-
"token_uri": "https://oauth2.googleapis.com/token",
|
|
90
|
-
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
91
|
-
"client_secret": "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",
|
|
92
|
-
"redirect_uris": ["https://auxcode.com"]
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
97
|
export default new GoogleAuthHelper();
|