@asgardeo/auth-react 1.1.13 → 1.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/README.md +25 -25
- package/dist/main.js +32 -51
- package/dist/src/authenticate.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +9 -17
- package/package.json +2 -2
- package/src/authenticate.tsx +15 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/authenticate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEH,iBAAiB,EAQpB,MAAM,oBAAoB,CAAC;AAE5B,OAAc,EACV,iBAAiB,
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/authenticate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEH,iBAAiB,EAQpB,MAAM,oBAAoB,CAAC;AAE5B,OAAc,EACV,iBAAiB,EAEjB,iBAAiB,EACjB,SAAS,EAOZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAe,MAAM,GAAG,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAsB,MAAM,UAAU,CAAC;AAcrF,UAAU,0BAA0B;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CA+MlF,CAAC;AAEF,QAAA,MAAM,cAAc,QAAO,oBAE1B,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -237,8 +237,8 @@
|
|
|
237
237
|
"affectsGlobalScope": false
|
|
238
238
|
},
|
|
239
239
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/data.d.ts": {
|
|
240
|
-
"version": "
|
|
241
|
-
"signature": "
|
|
240
|
+
"version": "ef558820fc7c6ac5a7f32117ac8a533639e636659f7370ff56a88e4ac362d963",
|
|
241
|
+
"signature": "ef558820fc7c6ac5a7f32117ac8a533639e636659f7370ff56a88e4ac362d963",
|
|
242
242
|
"affectsGlobalScope": false
|
|
243
243
|
},
|
|
244
244
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/parameters.d.ts": {
|
|
@@ -251,19 +251,14 @@
|
|
|
251
251
|
"signature": "1408465b7ef31763e5827b443a38d83d125e5d9ccb60ed23c49cbd5e16bb35e4",
|
|
252
252
|
"affectsGlobalScope": false
|
|
253
253
|
},
|
|
254
|
-
"../../node_modules/@asgardeo/auth-js/dist/src/constants/environments.d.ts": {
|
|
255
|
-
"version": "1d5f29a8df2a26f1f2a27aafc55e89708cb5648a57464d2424eafa795694e188",
|
|
256
|
-
"signature": "1d5f29a8df2a26f1f2a27aafc55e89708cb5648a57464d2424eafa795694e188",
|
|
257
|
-
"affectsGlobalScope": false
|
|
258
|
-
},
|
|
259
254
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/fetch.d.ts": {
|
|
260
255
|
"version": "8c590f6cab70aaa58ff3a785019b4065b0ad86aaed35b06f1e608511f0342066",
|
|
261
256
|
"signature": "8c590f6cab70aaa58ff3a785019b4065b0ad86aaed35b06f1e608511f0342066",
|
|
262
257
|
"affectsGlobalScope": false
|
|
263
258
|
},
|
|
264
259
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/index.d.ts": {
|
|
265
|
-
"version": "
|
|
266
|
-
"signature": "
|
|
260
|
+
"version": "5a96909505b035b618b7cf507602aa31861a3b4bed2c8316a4ddb93944599a24",
|
|
261
|
+
"signature": "5a96909505b035b618b7cf507602aa31861a3b4bed2c8316a4ddb93944599a24",
|
|
267
262
|
"affectsGlobalScope": false
|
|
268
263
|
},
|
|
269
264
|
"../../node_modules/@asgardeo/auth-js/dist/src/data/data-layer.d.ts": {
|
|
@@ -292,8 +287,8 @@
|
|
|
292
287
|
"affectsGlobalScope": false
|
|
293
288
|
},
|
|
294
289
|
"../../node_modules/@asgardeo/auth-js/dist/src/client.d.ts": {
|
|
295
|
-
"version": "
|
|
296
|
-
"signature": "
|
|
290
|
+
"version": "879d50966f7660197f183f5a411db9bf949567a056e38606c2ce0471a68b728f",
|
|
291
|
+
"signature": "879d50966f7660197f183f5a411db9bf949567a056e38606c2ce0471a68b728f",
|
|
297
292
|
"affectsGlobalScope": false
|
|
298
293
|
},
|
|
299
294
|
"../../node_modules/@asgardeo/auth-js/dist/src/utils/authentication-utils.d.ts": {
|
|
@@ -362,8 +357,8 @@
|
|
|
362
357
|
"affectsGlobalScope": false
|
|
363
358
|
},
|
|
364
359
|
"../../node_modules/@asgardeo/auth-spa/dist/src/helpers/spa-helper.d.ts": {
|
|
365
|
-
"version": "
|
|
366
|
-
"signature": "
|
|
360
|
+
"version": "c737e3fc34df82139f959eb93b08219bc386c7c88d1abe82cd9c14e46266d5d2",
|
|
361
|
+
"signature": "c737e3fc34df82139f959eb93b08219bc386c7c88d1abe82cd9c14e46266d5d2",
|
|
367
362
|
"affectsGlobalScope": false
|
|
368
363
|
},
|
|
369
364
|
"../../node_modules/@asgardeo/auth-spa/dist/src/http-client/models/axios-http-client.d.ts": {
|
|
@@ -626,7 +621,7 @@
|
|
|
626
621
|
"affectsGlobalScope": false
|
|
627
622
|
},
|
|
628
623
|
"../src/authenticate.tsx": {
|
|
629
|
-
"version": "
|
|
624
|
+
"version": "7b80cd0e2b843d12ad19d3c473efa3d95c4ce9854e6ff71dc71e7d131a3824b1",
|
|
630
625
|
"signature": "150d2de23192873482689c0b27ce8d8aa18d83441455f5402821f15f64b59133",
|
|
631
626
|
"affectsGlobalScope": false
|
|
632
627
|
},
|
|
@@ -1246,7 +1241,6 @@
|
|
|
1246
1241
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/client-config.d.ts",
|
|
1247
1242
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/custom-grant-template-tags.d.ts",
|
|
1248
1243
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/data.d.ts",
|
|
1249
|
-
"../../node_modules/@asgardeo/auth-js/dist/src/constants/environments.d.ts",
|
|
1250
1244
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/fetch.d.ts",
|
|
1251
1245
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/oidc-endpoints.d.ts",
|
|
1252
1246
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/parameters.d.ts",
|
|
@@ -1807,7 +1801,6 @@
|
|
|
1807
1801
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/client-config.d.ts",
|
|
1808
1802
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/custom-grant-template-tags.d.ts",
|
|
1809
1803
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/data.d.ts",
|
|
1810
|
-
"../../node_modules/@asgardeo/auth-js/dist/src/constants/environments.d.ts",
|
|
1811
1804
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/fetch.d.ts",
|
|
1812
1805
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/oidc-endpoints.d.ts",
|
|
1813
1806
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/parameters.d.ts",
|
|
@@ -2250,7 +2243,6 @@
|
|
|
2250
2243
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/client-config.d.ts",
|
|
2251
2244
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/custom-grant-template-tags.d.ts",
|
|
2252
2245
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/data.d.ts",
|
|
2253
|
-
"../../node_modules/@asgardeo/auth-js/dist/src/constants/environments.d.ts",
|
|
2254
2246
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/fetch.d.ts",
|
|
2255
2247
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/index.d.ts",
|
|
2256
2248
|
"../../node_modules/@asgardeo/auth-js/dist/src/constants/oidc-endpoints.d.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/auth-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "Asgardeo Auth React SDK for React Applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"WSO2",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"author": "WSO2",
|
|
37
37
|
"license": "Apache-2.0",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@asgardeo/auth-spa": "^0.4.
|
|
39
|
+
"@asgardeo/auth-spa": "^0.4.7"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@babel/cli": "^7.10.5",
|
package/src/authenticate.tsx
CHANGED
|
@@ -30,12 +30,14 @@ import {
|
|
|
30
30
|
import { SPACustomGrantConfig } from "@asgardeo/auth-spa/src/models/request-custom-grant";
|
|
31
31
|
import React, {
|
|
32
32
|
FunctionComponent,
|
|
33
|
+
MutableRefObject,
|
|
33
34
|
PropsWithChildren,
|
|
34
35
|
ReactNode,
|
|
35
36
|
createContext,
|
|
36
37
|
useContext,
|
|
37
38
|
useEffect,
|
|
38
39
|
useMemo,
|
|
40
|
+
useRef,
|
|
39
41
|
useState
|
|
40
42
|
} from "react";
|
|
41
43
|
import { AuthParams, ReactConfig } from ".";
|
|
@@ -131,6 +133,7 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
|
|
|
131
133
|
const trySignInSilently = () => AuthClient.trySignInSilently(state, dispatch);
|
|
132
134
|
|
|
133
135
|
const [ error, setError ] = useState<AsgardeoAuthException>();
|
|
136
|
+
const reRenderCheckRef: MutableRefObject<boolean> = useRef(false);
|
|
134
137
|
|
|
135
138
|
useEffect(() => {
|
|
136
139
|
if (state.isAuthenticated) {
|
|
@@ -146,6 +149,18 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
|
|
|
146
149
|
* Try signing in when the component is mounted.
|
|
147
150
|
*/
|
|
148
151
|
useEffect(() => {
|
|
152
|
+
// React 18.x Strict.Mode has a new check for `Ensuring reusable state` to facilitate an upcoming react feature.
|
|
153
|
+
// https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state
|
|
154
|
+
// This will remount all the useEffects to ensure that there are no unexpected side effects.
|
|
155
|
+
// When react remounts the signIn hook of the AuthProvider, it will cause a race condition. Hence, we have to
|
|
156
|
+
// prevent the re-render of this hook as suggested in the following discussion.
|
|
157
|
+
// https://github.com/reactwg/react-18/discussions/18#discussioncomment-795623
|
|
158
|
+
if (reRenderCheckRef.current) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
reRenderCheckRef.current = true;
|
|
163
|
+
|
|
149
164
|
(async () => {
|
|
150
165
|
let isSignedOut: boolean = false;
|
|
151
166
|
// If the component was mounted after the user was redirected to the application upon a successful logout,
|