@ts-core/oauth 3.0.16 → 3.0.17
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/cjs/OAuthBase.d.ts +1 -1
- package/cjs/OAuthBase.js +2 -2
- package/cjs/go/GoAuth.js +1 -1
- package/cjs/vk/VkAuth.d.ts +1 -0
- package/cjs/vk/VkAuth.js +7 -1
- package/esm/OAuthBase.d.ts +1 -1
- package/esm/OAuthBase.js +2 -2
- package/esm/go/GoAuth.js +1 -1
- package/esm/vk/VkAuth.d.ts +1 -0
- package/esm/vk/VkAuth.js +7 -1
- package/package.json +1 -1
package/cjs/OAuthBase.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare abstract class OAuthBase<T = any> extends LoggerWrapper {
|
|
|
17
17
|
protected _popUpCheckCloseTimer: any;
|
|
18
18
|
constructor(logger: ILogger, applicationId: string, window?: Window);
|
|
19
19
|
protected open(): Promise<IOAuthDto>;
|
|
20
|
-
protected
|
|
20
|
+
protected popUpOpen(): Window;
|
|
21
21
|
protected popUpFocus(): void;
|
|
22
22
|
protected popUpCheckClose: () => void;
|
|
23
23
|
protected getUrlParams(): URLSearchParams;
|
package/cjs/OAuthBase.js
CHANGED
|
@@ -55,7 +55,7 @@ class OAuthBase extends common_1.LoggerWrapper {
|
|
|
55
55
|
return this.promise.promise;
|
|
56
56
|
}
|
|
57
57
|
this.promise = common_1.PromiseHandler.create();
|
|
58
|
-
this.popUp = this.
|
|
58
|
+
this.popUp = this.popUpOpen();
|
|
59
59
|
this.popUpFocus();
|
|
60
60
|
if (this.popUpIsCheckClose) {
|
|
61
61
|
this.popUpCheckCloseTimer = setInterval(this.popUpCheckClose, common_1.DateUtil.MILLISECONDS_SECOND / 10);
|
|
@@ -64,7 +64,7 @@ class OAuthBase extends common_1.LoggerWrapper {
|
|
|
64
64
|
return this.promise.promise;
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
popUpOpen() {
|
|
68
68
|
let window = this.window;
|
|
69
69
|
let top = (window.screen.height - this.popUpHeight) / 2;
|
|
70
70
|
let left = (window.screen.width - this.popUpWidth) / 2;
|
package/cjs/go/GoAuth.js
CHANGED
|
@@ -15,7 +15,7 @@ const OAuthBase_1 = require("../OAuthBase");
|
|
|
15
15
|
class GoAuth extends OAuthBase_1.OAuthBase {
|
|
16
16
|
constructor(logger, applicationId, window) {
|
|
17
17
|
super(logger, applicationId, window);
|
|
18
|
-
this.urlParams.set('scope', 'https://www.googleapis.com/auth/userinfo.profile');
|
|
18
|
+
this.urlParams.set('scope', 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email');
|
|
19
19
|
}
|
|
20
20
|
getUrl() {
|
|
21
21
|
return `https://accounts.google.com/o/oauth2/v2/auth?${this.getUrlParams().toString()}`;
|
package/cjs/vk/VkAuth.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IOAuthDto, IOAuthToken, OAuthBase } from "../OAuthBase";
|
|
|
3
3
|
import { VkUser } from "./VkUser";
|
|
4
4
|
export declare class VkAuth<T extends VkUser = VkUser> extends OAuthBase<T> {
|
|
5
5
|
v: string;
|
|
6
|
+
private email;
|
|
6
7
|
constructor(logger: ILogger, applicationId: string, window?: Window);
|
|
7
8
|
protected getUrl(): string;
|
|
8
9
|
getProfile(token: string, fields?: string): Promise<T>;
|
package/cjs/vk/VkAuth.js
CHANGED
|
@@ -31,6 +31,9 @@ class VkAuth extends OAuthBase_1.OAuthBase {
|
|
|
31
31
|
let { response } = yield this.http.call('https://api.vk.com/method/users.get', { data: { access_token: token, v: this.v, fields } });
|
|
32
32
|
let item = new VkUser_1.VkUser();
|
|
33
33
|
item.parse(response[0]);
|
|
34
|
+
if (_.isNil(item.email)) {
|
|
35
|
+
item.email = this.email;
|
|
36
|
+
}
|
|
34
37
|
return item;
|
|
35
38
|
});
|
|
36
39
|
}
|
|
@@ -47,10 +50,13 @@ class VkAuth extends OAuthBase_1.OAuthBase {
|
|
|
47
50
|
if (!_.isNil(item.error_description)) {
|
|
48
51
|
throw new common_1.ExtendedError(item.error_description);
|
|
49
52
|
}
|
|
53
|
+
if (!_.isNil(item.email)) {
|
|
54
|
+
this.email = item.email;
|
|
55
|
+
}
|
|
50
56
|
return {
|
|
57
|
+
userId: item.user_id,
|
|
51
58
|
expiresIn: item.expires_in,
|
|
52
59
|
accessToken: item.access_token,
|
|
53
|
-
userId: item.user_id,
|
|
54
60
|
};
|
|
55
61
|
});
|
|
56
62
|
}
|
package/esm/OAuthBase.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare abstract class OAuthBase<T = any> extends LoggerWrapper {
|
|
|
17
17
|
protected _popUpCheckCloseTimer: any;
|
|
18
18
|
constructor(logger: ILogger, applicationId: string, window?: Window);
|
|
19
19
|
protected open(): Promise<IOAuthDto>;
|
|
20
|
-
protected
|
|
20
|
+
protected popUpOpen(): Window;
|
|
21
21
|
protected popUpFocus(): void;
|
|
22
22
|
protected popUpCheckClose: () => void;
|
|
23
23
|
protected getUrlParams(): URLSearchParams;
|
package/esm/OAuthBase.js
CHANGED
|
@@ -52,7 +52,7 @@ export class OAuthBase extends LoggerWrapper {
|
|
|
52
52
|
return this.promise.promise;
|
|
53
53
|
}
|
|
54
54
|
this.promise = PromiseHandler.create();
|
|
55
|
-
this.popUp = this.
|
|
55
|
+
this.popUp = this.popUpOpen();
|
|
56
56
|
this.popUpFocus();
|
|
57
57
|
if (this.popUpIsCheckClose) {
|
|
58
58
|
this.popUpCheckCloseTimer = setInterval(this.popUpCheckClose, DateUtil.MILLISECONDS_SECOND / 10);
|
|
@@ -61,7 +61,7 @@ export class OAuthBase extends LoggerWrapper {
|
|
|
61
61
|
return this.promise.promise;
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
popUpOpen() {
|
|
65
65
|
let window = this.window;
|
|
66
66
|
let top = (window.screen.height - this.popUpHeight) / 2;
|
|
67
67
|
let left = (window.screen.width - this.popUpWidth) / 2;
|
package/esm/go/GoAuth.js
CHANGED
|
@@ -12,7 +12,7 @@ import { OAuthBase } from '../OAuthBase';
|
|
|
12
12
|
export class GoAuth extends OAuthBase {
|
|
13
13
|
constructor(logger, applicationId, window) {
|
|
14
14
|
super(logger, applicationId, window);
|
|
15
|
-
this.urlParams.set('scope', 'https://www.googleapis.com/auth/userinfo.profile');
|
|
15
|
+
this.urlParams.set('scope', 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email');
|
|
16
16
|
}
|
|
17
17
|
getUrl() {
|
|
18
18
|
return `https://accounts.google.com/o/oauth2/v2/auth?${this.getUrlParams().toString()}`;
|
package/esm/vk/VkAuth.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IOAuthDto, IOAuthToken, OAuthBase } from "../OAuthBase";
|
|
|
3
3
|
import { VkUser } from "./VkUser";
|
|
4
4
|
export declare class VkAuth<T extends VkUser = VkUser> extends OAuthBase<T> {
|
|
5
5
|
v: string;
|
|
6
|
+
private email;
|
|
6
7
|
constructor(logger: ILogger, applicationId: string, window?: Window);
|
|
7
8
|
protected getUrl(): string;
|
|
8
9
|
getProfile(token: string, fields?: string): Promise<T>;
|
package/esm/vk/VkAuth.js
CHANGED
|
@@ -28,6 +28,9 @@ export class VkAuth extends OAuthBase {
|
|
|
28
28
|
let { response } = yield this.http.call('https://api.vk.com/method/users.get', { data: { access_token: token, v: this.v, fields } });
|
|
29
29
|
let item = new VkUser();
|
|
30
30
|
item.parse(response[0]);
|
|
31
|
+
if (_.isNil(item.email)) {
|
|
32
|
+
item.email = this.email;
|
|
33
|
+
}
|
|
31
34
|
return item;
|
|
32
35
|
});
|
|
33
36
|
}
|
|
@@ -44,10 +47,13 @@ export class VkAuth extends OAuthBase {
|
|
|
44
47
|
if (!_.isNil(item.error_description)) {
|
|
45
48
|
throw new ExtendedError(item.error_description);
|
|
46
49
|
}
|
|
50
|
+
if (!_.isNil(item.email)) {
|
|
51
|
+
this.email = item.email;
|
|
52
|
+
}
|
|
47
53
|
return {
|
|
54
|
+
userId: item.user_id,
|
|
48
55
|
expiresIn: item.expires_in,
|
|
49
56
|
accessToken: item.access_token,
|
|
50
|
-
userId: item.user_id,
|
|
51
57
|
};
|
|
52
58
|
});
|
|
53
59
|
}
|