@ts-core/oauth 3.0.9 → 3.0.11
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.js +3 -0
- package/cjs/OAuthParser.d.ts +3 -3
- package/cjs/OAuthParser.js +5 -7
- package/esm/OAuthBase.js +3 -0
- package/esm/OAuthParser.d.ts +3 -3
- package/esm/OAuthParser.js +5 -7
- package/package.json +1 -1
package/cjs/OAuthBase.js
CHANGED
|
@@ -46,6 +46,9 @@ class OAuthBase extends common_1.LoggerWrapper {
|
|
|
46
46
|
open() {
|
|
47
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
48
|
if (!_.isNil(this.promise)) {
|
|
49
|
+
if (!_.isNil(this.popUp) && !this.popUp.closed) {
|
|
50
|
+
this.popUp.focus();
|
|
51
|
+
}
|
|
49
52
|
return this.promise.promise;
|
|
50
53
|
}
|
|
51
54
|
this.promise = common_1.PromiseHandler.create();
|
package/cjs/OAuthParser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IOAuthPopUpDto } from './OAuthBase';
|
|
2
2
|
export declare class OAuthParser {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
parse(params: any, fragment: string): IOAuthPopUpDto;
|
|
3
|
+
static NAMES: Array<string>;
|
|
4
|
+
static ERRORS: Array<string>;
|
|
5
|
+
static parse(params: any, fragment: string): IOAuthPopUpDto;
|
|
6
6
|
}
|
package/cjs/OAuthParser.js
CHANGED
|
@@ -3,21 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OAuthParser = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
class OAuthParser {
|
|
6
|
-
|
|
7
|
-
this.names = ['code', 'access_token'];
|
|
8
|
-
this.errors = ['error_description', 'error'];
|
|
9
|
-
}
|
|
10
|
-
parse(params, fragment) {
|
|
6
|
+
static parse(params, fragment) {
|
|
11
7
|
let item = new URLSearchParams();
|
|
12
8
|
_.forIn(params, (value, key) => item.append(key, value));
|
|
13
9
|
new URLSearchParams(fragment).forEach((value, key) => item.append(key, value));
|
|
14
10
|
let oAuthError = null;
|
|
15
11
|
let oAuthCodeOrToken = null;
|
|
16
12
|
item.forEach((value, key) => {
|
|
17
|
-
if (
|
|
13
|
+
if (OAuthParser.NAMES.includes(key)) {
|
|
18
14
|
oAuthCodeOrToken = value;
|
|
19
15
|
}
|
|
20
|
-
else if (
|
|
16
|
+
else if (OAuthParser.ERRORS.includes(key)) {
|
|
21
17
|
oAuthError = value;
|
|
22
18
|
}
|
|
23
19
|
if (!_.isEmpty(oAuthCodeOrToken) || !_.isEmpty(oAuthError)) {
|
|
@@ -28,3 +24,5 @@ class OAuthParser {
|
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
exports.OAuthParser = OAuthParser;
|
|
27
|
+
OAuthParser.NAMES = ['code', 'access_token'];
|
|
28
|
+
OAuthParser.ERRORS = ['error_description', 'error'];
|
package/esm/OAuthBase.js
CHANGED
|
@@ -43,6 +43,9 @@ export class OAuthBase extends LoggerWrapper {
|
|
|
43
43
|
open() {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
if (!_.isNil(this.promise)) {
|
|
46
|
+
if (!_.isNil(this.popUp) && !this.popUp.closed) {
|
|
47
|
+
this.popUp.focus();
|
|
48
|
+
}
|
|
46
49
|
return this.promise.promise;
|
|
47
50
|
}
|
|
48
51
|
this.promise = PromiseHandler.create();
|
package/esm/OAuthParser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IOAuthPopUpDto } from './OAuthBase';
|
|
2
2
|
export declare class OAuthParser {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
parse(params: any, fragment: string): IOAuthPopUpDto;
|
|
3
|
+
static NAMES: Array<string>;
|
|
4
|
+
static ERRORS: Array<string>;
|
|
5
|
+
static parse(params: any, fragment: string): IOAuthPopUpDto;
|
|
6
6
|
}
|
package/esm/OAuthParser.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import * as _ from 'lodash';
|
|
2
2
|
export class OAuthParser {
|
|
3
|
-
|
|
4
|
-
this.names = ['code', 'access_token'];
|
|
5
|
-
this.errors = ['error_description', 'error'];
|
|
6
|
-
}
|
|
7
|
-
parse(params, fragment) {
|
|
3
|
+
static parse(params, fragment) {
|
|
8
4
|
let item = new URLSearchParams();
|
|
9
5
|
_.forIn(params, (value, key) => item.append(key, value));
|
|
10
6
|
new URLSearchParams(fragment).forEach((value, key) => item.append(key, value));
|
|
11
7
|
let oAuthError = null;
|
|
12
8
|
let oAuthCodeOrToken = null;
|
|
13
9
|
item.forEach((value, key) => {
|
|
14
|
-
if (
|
|
10
|
+
if (OAuthParser.NAMES.includes(key)) {
|
|
15
11
|
oAuthCodeOrToken = value;
|
|
16
12
|
}
|
|
17
|
-
else if (
|
|
13
|
+
else if (OAuthParser.ERRORS.includes(key)) {
|
|
18
14
|
oAuthError = value;
|
|
19
15
|
}
|
|
20
16
|
if (!_.isEmpty(oAuthCodeOrToken) || !_.isEmpty(oAuthError)) {
|
|
@@ -24,3 +20,5 @@ export class OAuthParser {
|
|
|
24
20
|
return null;
|
|
25
21
|
}
|
|
26
22
|
}
|
|
23
|
+
OAuthParser.NAMES = ['code', 'access_token'];
|
|
24
|
+
OAuthParser.ERRORS = ['error_description', 'error'];
|