supaapps-auth 1.0.5 → 1.0.6
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/dist/AuthManager.d.ts +1 -1
- package/dist/AuthManager.js +9 -3
- package/package.json +1 -1
- package/src/AuthManager.ts +11 -4
package/dist/AuthManager.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class AuthManager {
|
|
|
8
8
|
static getInstance<T>(): AuthManager;
|
|
9
9
|
private toBase64Url;
|
|
10
10
|
private generatePKCEPair;
|
|
11
|
-
mustBeLoggedIn(): Promise<
|
|
11
|
+
mustBeLoggedIn(): Promise<boolean>;
|
|
12
12
|
getLoginWithGoogleUri(): string;
|
|
13
13
|
isLoggedIn(): Promise<boolean>;
|
|
14
14
|
getAccessToken(): Promise<string>;
|
package/dist/AuthManager.js
CHANGED
|
@@ -49,9 +49,15 @@ class AuthManager {
|
|
|
49
49
|
}
|
|
50
50
|
mustBeLoggedIn() {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
this.isLoggedIn().then((isLoggedIn) => {
|
|
54
|
+
if (!isLoggedIn) {
|
|
55
|
+
this.loginCallback();
|
|
56
|
+
return resolve(false);
|
|
57
|
+
}
|
|
58
|
+
return resolve(true);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
55
61
|
});
|
|
56
62
|
}
|
|
57
63
|
getLoginWithGoogleUri() {
|
package/package.json
CHANGED
package/src/AuthManager.ts
CHANGED
|
@@ -50,11 +50,18 @@ export class AuthManager {
|
|
|
50
50
|
return { newCodeVerifier, newCodeChallenge };
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
public async mustBeLoggedIn(): Promise<
|
|
54
|
-
|
|
55
|
-
this.
|
|
56
|
-
|
|
53
|
+
public async mustBeLoggedIn(): Promise<boolean> {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
this.isLoggedIn().then((isLoggedIn) => {
|
|
56
|
+
if (!isLoggedIn) {
|
|
57
|
+
this.loginCallback();
|
|
58
|
+
return resolve(false);
|
|
59
|
+
}
|
|
60
|
+
return resolve(true);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
57
63
|
}
|
|
64
|
+
|
|
58
65
|
public getLoginWithGoogleUri(): string {
|
|
59
66
|
// get or create codeVerifier and codeChallenge from localstorage
|
|
60
67
|
const { newCodeVerifier, newCodeChallenge } = this.generatePKCEPair();
|