@logto/browser 0.1.14 → 0.1.16
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/lib/index.js +7 -6
- package/package.json +3 -4
package/lib/index.js
CHANGED
|
@@ -35,7 +35,10 @@ class LogtoClient {
|
|
|
35
35
|
this.getJwtVerifyGetKey = (0, lodash_once_1.default)(this._getJwtVerifyGetKey);
|
|
36
36
|
this.accessTokenMap = new Map();
|
|
37
37
|
this.getAccessTokenPromiseMap = new Map();
|
|
38
|
-
this.logtoConfig =
|
|
38
|
+
this.logtoConfig = {
|
|
39
|
+
...logtoConfig,
|
|
40
|
+
scopes: (0, js_1.withReservedScopes)(logtoConfig.scopes).split(' '),
|
|
41
|
+
};
|
|
39
42
|
this.logtoStorageKey = (0, utils_1.buildLogtoKey)(logtoConfig.appId);
|
|
40
43
|
this.requester = requester;
|
|
41
44
|
this._idToken = localStorage.getItem((0, utils_1.buildIdTokenKey)(this.logtoStorageKey));
|
|
@@ -136,12 +139,11 @@ class LogtoClient {
|
|
|
136
139
|
return (0, js_1.fetchUserInfo)(userinfoEndpoint, accessToken, this.requester);
|
|
137
140
|
}
|
|
138
141
|
async signIn(redirectUri) {
|
|
139
|
-
const { appId: clientId, resources, scopes
|
|
142
|
+
const { appId: clientId, resources, scopes } = this.logtoConfig;
|
|
140
143
|
const { authorizationEndpoint } = await this.getOidcConfig();
|
|
141
144
|
const codeVerifier = (0, js_1.generateCodeVerifier)();
|
|
142
145
|
const codeChallenge = await (0, js_1.generateCodeChallenge)(codeVerifier);
|
|
143
146
|
const state = (0, js_1.generateState)();
|
|
144
|
-
const scopes = (0, js_1.withReservedScopes)(customScopes).split(' ');
|
|
145
147
|
const signInUri = (0, js_1.generateSignInUri)({
|
|
146
148
|
authorizationEndpoint,
|
|
147
149
|
clientId,
|
|
@@ -215,10 +217,9 @@ class LogtoClient {
|
|
|
215
217
|
}
|
|
216
218
|
try {
|
|
217
219
|
const accessTokenKey = (0, utils_1.buildAccessTokenKey)(resource);
|
|
218
|
-
const { appId: clientId
|
|
220
|
+
const { appId: clientId } = this.logtoConfig;
|
|
219
221
|
const { tokenEndpoint } = await this.getOidcConfig();
|
|
220
|
-
const
|
|
221
|
-
const { accessToken, refreshToken, idToken, scope, expiresIn } = await (0, js_1.fetchTokenByRefreshToken)({ clientId, tokenEndpoint, refreshToken: this.refreshToken, resource, scopes }, this.requester);
|
|
222
|
+
const { accessToken, refreshToken, idToken, scope, expiresIn } = await (0, js_1.fetchTokenByRefreshToken)({ clientId, tokenEndpoint, refreshToken: this.refreshToken, resource }, this.requester);
|
|
222
223
|
this.accessTokenMap.set(accessTokenKey, {
|
|
223
224
|
token: accessToken,
|
|
224
225
|
scope,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"exports": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"dev:tsc": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
|
|
18
|
-
"preinstall": "npx only-allow pnpm",
|
|
19
18
|
"precommit": "lint-staged",
|
|
20
19
|
"build": "rm -rf lib/ && tsc -p tsconfig.build.json",
|
|
21
20
|
"lint": "eslint --ext .ts src",
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
"prepack": "pnpm test"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@logto/js": "^0.1.
|
|
26
|
+
"@logto/js": "^0.1.16",
|
|
28
27
|
"@silverhand/essentials": "^1.1.6",
|
|
29
28
|
"jose": "^4.5.0",
|
|
30
29
|
"lodash.get": "^4.4.2",
|
|
@@ -55,5 +54,5 @@
|
|
|
55
54
|
"publishConfig": {
|
|
56
55
|
"access": "public"
|
|
57
56
|
},
|
|
58
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "b56e794cea7ba791c73cd2da6e4ea405223d6970"
|
|
59
58
|
}
|