@auxcode/auxta 1.3.51-beta.7 → 1.3.51-beta.8
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/AuxGoogleAuth.d.ts +1 -0
- package/build/cjs/macros/helpers/AuxGoogleAuth.js +11 -3
- package/build/esm/macros/helpers/AuxGoogleAuth.d.ts +1 -0
- package/build/esm/macros/helpers/AuxGoogleAuth.js +11 -3
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ export declare class AuxGoogleAuth {
|
|
|
6
6
|
static get googleClient(): googleType.GoogleApis;
|
|
7
7
|
static get gmailClient(): googleType.gmail_v1.Gmail;
|
|
8
8
|
static setupBrowser(): Promise<void>;
|
|
9
|
+
static setEmailPassword(email: string, password: string): Promise<void>;
|
|
9
10
|
static setupHeadless(): Promise<void>;
|
|
10
11
|
private static authorize;
|
|
11
12
|
private static authorizeHeadless;
|
|
@@ -33,6 +33,8 @@ const SCOPES = [
|
|
|
33
33
|
];
|
|
34
34
|
const TOKEN_PATH = 'token.json';
|
|
35
35
|
let TOKEN = '';
|
|
36
|
+
let EMAIL = '';
|
|
37
|
+
let PASSWORD = '';
|
|
36
38
|
class AuxGoogleAuth {
|
|
37
39
|
static get oAuth2Client() {
|
|
38
40
|
return this._oAuth2Client;
|
|
@@ -48,6 +50,12 @@ class AuxGoogleAuth {
|
|
|
48
50
|
yield this.authorize(this.credentialsJson);
|
|
49
51
|
});
|
|
50
52
|
}
|
|
53
|
+
static setEmailPassword(email, password) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
EMAIL = email;
|
|
56
|
+
PASSWORD = password;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
51
59
|
static setupHeadless() {
|
|
52
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
61
|
yield this.authorizeHeadless(this.credentialsJson);
|
|
@@ -123,7 +131,7 @@ class AuxGoogleAuth {
|
|
|
123
131
|
prompt: 'consent',
|
|
124
132
|
scope: SCOPES,
|
|
125
133
|
});
|
|
126
|
-
const code = this.LogIn(authUrl);
|
|
134
|
+
const code = yield this.LogIn(authUrl);
|
|
127
135
|
oAuth2Client.getToken(code, (err, token) => {
|
|
128
136
|
if (err)
|
|
129
137
|
return console.error('Error retrieving access token', err);
|
|
@@ -141,11 +149,11 @@ class AuxGoogleAuth {
|
|
|
141
149
|
yield page.goto(authUrl);
|
|
142
150
|
yield page.waitForNetworkIdle();
|
|
143
151
|
yield code_helper_1.default.waitForSelector('visible', '#identifierId');
|
|
144
|
-
yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(
|
|
152
|
+
yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
|
|
145
153
|
yield (yield page.$$('button'))[3].click();
|
|
146
154
|
yield page.waitForNetworkIdle();
|
|
147
155
|
yield code_helper_1.default.waitForSelector('visible', 'input[type="password"]');
|
|
148
|
-
yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type(
|
|
156
|
+
yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type(PASSWORD));
|
|
149
157
|
yield (yield page.$$('button'))[1].click();
|
|
150
158
|
yield page.waitForNetworkIdle();
|
|
151
159
|
yield code_helper_1.default.waitForSelector('visible', '#headingText');
|
|
@@ -6,6 +6,7 @@ export declare class AuxGoogleAuth {
|
|
|
6
6
|
static get googleClient(): googleType.GoogleApis;
|
|
7
7
|
static get gmailClient(): googleType.gmail_v1.Gmail;
|
|
8
8
|
static setupBrowser(): Promise<void>;
|
|
9
|
+
static setEmailPassword(email: string, password: string): Promise<void>;
|
|
9
10
|
static setupHeadless(): Promise<void>;
|
|
10
11
|
private static authorize;
|
|
11
12
|
private static authorizeHeadless;
|
|
@@ -27,6 +27,8 @@ const SCOPES = [
|
|
|
27
27
|
];
|
|
28
28
|
const TOKEN_PATH = 'token.json';
|
|
29
29
|
let TOKEN = '';
|
|
30
|
+
let EMAIL = '';
|
|
31
|
+
let PASSWORD = '';
|
|
30
32
|
export class AuxGoogleAuth {
|
|
31
33
|
static get oAuth2Client() {
|
|
32
34
|
return this._oAuth2Client;
|
|
@@ -42,6 +44,12 @@ export class AuxGoogleAuth {
|
|
|
42
44
|
yield this.authorize(this.credentialsJson);
|
|
43
45
|
});
|
|
44
46
|
}
|
|
47
|
+
static setEmailPassword(email, password) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
EMAIL = email;
|
|
50
|
+
PASSWORD = password;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
45
53
|
static setupHeadless() {
|
|
46
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
55
|
yield this.authorizeHeadless(this.credentialsJson);
|
|
@@ -117,7 +125,7 @@ export class AuxGoogleAuth {
|
|
|
117
125
|
prompt: 'consent',
|
|
118
126
|
scope: SCOPES,
|
|
119
127
|
});
|
|
120
|
-
const code = this.LogIn(authUrl);
|
|
128
|
+
const code = yield this.LogIn(authUrl);
|
|
121
129
|
oAuth2Client.getToken(code, (err, token) => {
|
|
122
130
|
if (err)
|
|
123
131
|
return console.error('Error retrieving access token', err);
|
|
@@ -135,11 +143,11 @@ export class AuxGoogleAuth {
|
|
|
135
143
|
yield page.goto(authUrl);
|
|
136
144
|
yield page.waitForNetworkIdle();
|
|
137
145
|
yield FunctionHelper.waitForSelector('visible', '#identifierId');
|
|
138
|
-
yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(
|
|
146
|
+
yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
|
|
139
147
|
yield (yield page.$$('button'))[3].click();
|
|
140
148
|
yield page.waitForNetworkIdle();
|
|
141
149
|
yield FunctionHelper.waitForSelector('visible', 'input[type="password"]');
|
|
142
|
-
yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type(
|
|
150
|
+
yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type(PASSWORD));
|
|
143
151
|
yield (yield page.$$('button'))[1].click();
|
|
144
152
|
yield page.waitForNetworkIdle();
|
|
145
153
|
yield FunctionHelper.waitForSelector('visible', '#headingText');
|