@frontegg/redux-store 7.111.0 → 7.113.0
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/auth/LoginState/actions/hostedLoginAuthorize.actions.js +3 -3
- package/auth/LoginState/actions/index.js +25 -0
- package/index.js +1 -1
- package/node/auth/LoginState/actions/hostedLoginAuthorize.actions.js +3 -3
- package/node/auth/LoginState/actions/index.js +25 -0
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ export default ((store, api, sharedActions) => {
|
|
|
14
14
|
const __requestHostedLoginSilentAuthorize = async () => {
|
|
15
15
|
var _response;
|
|
16
16
|
let response;
|
|
17
|
-
if (FronteggNativeModule.
|
|
17
|
+
if (FronteggNativeModule.isGetTokensAvailable()) {
|
|
18
18
|
const tokens = await FronteggNativeModule.getTokens();
|
|
19
19
|
response = await api.auth.silentOAuthRefreshTokenV3(tokens);
|
|
20
20
|
} else {
|
|
@@ -87,7 +87,7 @@ export default ((store, api, sharedActions) => {
|
|
|
87
87
|
if (tenantId) {
|
|
88
88
|
params['tenantId'] = tenantId;
|
|
89
89
|
}
|
|
90
|
-
if (FronteggNativeModule.
|
|
90
|
+
if (FronteggNativeModule.isAvailable('closeWindow')) {
|
|
91
91
|
return FronteggNativeModule.closeWindow('not_authorized');
|
|
92
92
|
}
|
|
93
93
|
const searchParams = new URLSearchParams(params);
|
|
@@ -140,7 +140,7 @@ export default ((store, api, sharedActions) => {
|
|
|
140
140
|
additionalParams = additionalParams || {};
|
|
141
141
|
additionalParams['login_direct_action'] = btoa(JSON.stringify(loginDirectAction));
|
|
142
142
|
}
|
|
143
|
-
if (FronteggNativeModule.
|
|
143
|
+
if (FronteggNativeModule.isAvailable('requestAuthorize')) {
|
|
144
144
|
return FronteggNativeModule.requestAuthorize(payload);
|
|
145
145
|
}
|
|
146
146
|
if (((_additionalParams = additionalParams) == null ? void 0 : _additionalParams['prompt']) === 'login') {
|
|
@@ -136,8 +136,33 @@ export default ((store, api, sharedActions) => {
|
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
+
/** @private */
|
|
140
|
+
const __refreshTokenWithNativeTokens = async () => {
|
|
141
|
+
try {
|
|
142
|
+
const tokens = await FronteggNativeModule.getTokens();
|
|
143
|
+
const response = await api.auth.silentOAuthRefreshTokenV3(tokens);
|
|
144
|
+
const updatedUser = await __handleUnnecessaryEntitlementsUpdate(response.user);
|
|
145
|
+
actions.afterAuthenticationStateUpdate(_extends({}, response, {
|
|
146
|
+
user: updatedUser
|
|
147
|
+
}), {
|
|
148
|
+
isAuthenticated: true
|
|
149
|
+
});
|
|
150
|
+
} catch (e) {
|
|
151
|
+
contextHolder.setAccessToken(null);
|
|
152
|
+
contextHolder.setUser(null);
|
|
153
|
+
actions.setAuthState({
|
|
154
|
+
user: null,
|
|
155
|
+
isAuthenticated: false
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
139
160
|
/** @protected */
|
|
140
161
|
const __refreshToken = async () => {
|
|
162
|
+
if (FronteggNativeModule.isGetTokensAvailable()) {
|
|
163
|
+
await __refreshTokenWithNativeTokens();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
141
166
|
const hostedLoginBox = store.auth.hostedLoginBox;
|
|
142
167
|
if (hostedLoginBox) {
|
|
143
168
|
await __refreshTokenHosted();
|
package/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
21
21
|
const __requestHostedLoginSilentAuthorize = async () => {
|
|
22
22
|
var _response;
|
|
23
23
|
let response;
|
|
24
|
-
if (_toolkit.FronteggNativeModule.
|
|
24
|
+
if (_toolkit.FronteggNativeModule.isGetTokensAvailable()) {
|
|
25
25
|
const tokens = await _toolkit.FronteggNativeModule.getTokens();
|
|
26
26
|
response = await api.auth.silentOAuthRefreshTokenV3(tokens);
|
|
27
27
|
} else {
|
|
@@ -94,7 +94,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
94
94
|
if (tenantId) {
|
|
95
95
|
params['tenantId'] = tenantId;
|
|
96
96
|
}
|
|
97
|
-
if (_toolkit.FronteggNativeModule.
|
|
97
|
+
if (_toolkit.FronteggNativeModule.isAvailable('closeWindow')) {
|
|
98
98
|
return _toolkit.FronteggNativeModule.closeWindow('not_authorized');
|
|
99
99
|
}
|
|
100
100
|
const searchParams = new URLSearchParams(params);
|
|
@@ -147,7 +147,7 @@ var _default = (store, api, sharedActions) => {
|
|
|
147
147
|
additionalParams = additionalParams || {};
|
|
148
148
|
additionalParams['login_direct_action'] = btoa(JSON.stringify(loginDirectAction));
|
|
149
149
|
}
|
|
150
|
-
if (_toolkit.FronteggNativeModule.
|
|
150
|
+
if (_toolkit.FronteggNativeModule.isAvailable('requestAuthorize')) {
|
|
151
151
|
return _toolkit.FronteggNativeModule.requestAuthorize(payload);
|
|
152
152
|
}
|
|
153
153
|
if (((_additionalParams = additionalParams) == null ? void 0 : _additionalParams['prompt']) === 'login') {
|
|
@@ -143,8 +143,33 @@ var _default = (store, api, sharedActions) => {
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
+
/** @private */
|
|
147
|
+
const __refreshTokenWithNativeTokens = async () => {
|
|
148
|
+
try {
|
|
149
|
+
const tokens = await _toolkit.FronteggNativeModule.getTokens();
|
|
150
|
+
const response = await api.auth.silentOAuthRefreshTokenV3(tokens);
|
|
151
|
+
const updatedUser = await __handleUnnecessaryEntitlementsUpdate(response.user);
|
|
152
|
+
actions.afterAuthenticationStateUpdate((0, _extends2.default)({}, response, {
|
|
153
|
+
user: updatedUser
|
|
154
|
+
}), {
|
|
155
|
+
isAuthenticated: true
|
|
156
|
+
});
|
|
157
|
+
} catch (e) {
|
|
158
|
+
contextHolder.setAccessToken(null);
|
|
159
|
+
contextHolder.setUser(null);
|
|
160
|
+
actions.setAuthState({
|
|
161
|
+
user: null,
|
|
162
|
+
isAuthenticated: false
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
146
167
|
/** @protected */
|
|
147
168
|
const __refreshToken = async () => {
|
|
169
|
+
if (_toolkit.FronteggNativeModule.isGetTokensAvailable()) {
|
|
170
|
+
await __refreshTokenWithNativeTokens();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
148
173
|
const hostedLoginBox = store.auth.hostedLoginBox;
|
|
149
174
|
if (hostedLoginBox) {
|
|
150
175
|
await __refreshTokenHosted();
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.113.0",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
9
|
"@frontegg/entitlements-javascript-commons": "1.1.2",
|
|
10
|
-
"@frontegg/rest-api": "7.
|
|
10
|
+
"@frontegg/rest-api": "7.113.0",
|
|
11
11
|
"fast-deep-equal": "3.1.3",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"proxy-compare": "^3.0.0",
|