@multiplatform.one/keycloak 1.0.36 → 2.0.1
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/cjs/Authenticated.js +9 -4
- package/dist/cjs/Authenticated.js.map +1 -1
- package/dist/cjs/Authenticated.native.js +7 -22
- package/dist/cjs/Authenticated.native.js.map +2 -2
- package/dist/cjs/Loading.js +25 -0
- package/dist/cjs/Loading.js.map +6 -0
- package/dist/cjs/Loading.native.js +31 -0
- package/dist/cjs/Loading.native.js.map +6 -0
- package/dist/cjs/hooks/useTokensFromState.js +5 -4
- package/dist/cjs/hooks/useTokensFromState.js.map +1 -1
- package/dist/cjs/hooks/useTokensFromState.native.js +6 -5
- package/dist/cjs/hooks/useTokensFromState.native.js.map +2 -2
- package/dist/cjs/keycloak/context.js.map +1 -1
- package/dist/cjs/keycloak/context.native.js.map +1 -1
- package/dist/cjs/keycloak/keycloak.js +10 -7
- package/dist/cjs/keycloak/keycloak.js.map +1 -1
- package/dist/cjs/keycloak/keycloak.native.js +27 -209
- package/dist/cjs/keycloak/keycloak.native.js.map +2 -2
- package/dist/cjs/provider/AfterAuth.js +12 -7
- package/dist/cjs/provider/AfterAuth.js.map +1 -1
- package/dist/cjs/provider/AfterAuth.native.js +6 -4
- package/dist/cjs/provider/AfterAuth.native.js.map +2 -2
- package/dist/cjs/provider/AuthProvider/AuthProvider.js +59 -23
- package/dist/cjs/provider/AuthProvider/AuthProvider.js.map +1 -1
- package/dist/cjs/provider/AuthProvider/AuthProvider.native.js +80 -321
- package/dist/cjs/provider/AuthProvider/AuthProvider.native.js.map +2 -2
- package/dist/cjs/provider/KeycloakProvider.js +4 -1
- package/dist/cjs/provider/KeycloakProvider.js.map +1 -1
- package/dist/cjs/provider/KeycloakProvider.native.js +1 -1
- package/dist/cjs/provider/KeycloakProvider.native.js.map +1 -1
- package/dist/cjs/routes.js +11 -10
- package/dist/cjs/routes.js.map +1 -1
- package/dist/cjs/routes.native.js +89 -333
- package/dist/cjs/routes.native.js.map +2 -2
- package/dist/cjs/session/session.js.map +1 -1
- package/dist/cjs/session/session.native.js +2 -122
- package/dist/cjs/session/session.native.js.map +1 -1
- package/dist/cjs/state.js +10 -14
- package/dist/cjs/state.js.map +1 -1
- package/dist/cjs/state.native.js +20 -11
- package/dist/cjs/state.native.js.map +2 -2
- package/dist/cjs/token.js.map +1 -1
- package/dist/cjs/token.native.js +1 -1
- package/dist/cjs/token.native.js.map +1 -1
- package/dist/esm/Authenticated.js +11 -4
- package/dist/esm/Authenticated.js.map +1 -1
- package/dist/esm/Authenticated.mjs +7 -5
- package/dist/esm/Authenticated.mjs.map +1 -0
- package/dist/esm/Authenticated.native.js +26 -37
- package/dist/esm/Authenticated.native.js.map +1 -6
- package/dist/esm/Loading.js +11 -0
- package/dist/esm/Loading.js.map +6 -0
- package/dist/esm/Loading.mjs +16 -0
- package/dist/esm/Loading.mjs.map +1 -0
- package/dist/esm/Loading.native.js +17 -0
- package/dist/esm/Loading.native.js.map +1 -0
- package/dist/esm/authConfig.mjs +2 -1
- package/dist/esm/authConfig.mjs.map +1 -0
- package/dist/esm/authConfig.native.js +5 -6
- package/dist/esm/authConfig.native.js.map +1 -6
- package/dist/esm/hooks/index.mjs +3 -2
- package/dist/esm/hooks/index.mjs.map +1 -0
- package/dist/esm/hooks/index.native.js +3 -3
- package/dist/esm/hooks/index.native.js.map +1 -6
- package/dist/esm/hooks/useAuthConfig.mjs +2 -1
- package/dist/esm/hooks/useAuthConfig.mjs.map +1 -0
- package/dist/esm/hooks/useAuthConfig.native.js +3 -5
- package/dist/esm/hooks/useAuthConfig.native.js.map +1 -6
- package/dist/esm/hooks/useTokensFromQuery/index.mjs +2 -1
- package/dist/esm/hooks/useTokensFromQuery/index.mjs.map +1 -0
- package/dist/esm/hooks/useTokensFromQuery/index.native.js +2 -4
- package/dist/esm/hooks/useTokensFromQuery/index.native.js.map +1 -6
- package/dist/esm/hooks/useTokensFromState.js +6 -5
- package/dist/esm/hooks/useTokensFromState.js.map +1 -1
- package/dist/esm/hooks/useTokensFromState.mjs +6 -5
- package/dist/esm/hooks/useTokensFromState.mjs.map +1 -0
- package/dist/esm/hooks/useTokensFromState.native.js +7 -9
- package/dist/esm/hooks/useTokensFromState.native.js.map +1 -6
- package/dist/esm/index.mjs +6 -5
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +4 -4
- package/dist/esm/index.native.js.map +1 -6
- package/dist/esm/keycloak/config.mjs +2 -1
- package/dist/esm/keycloak/config.mjs.map +1 -0
- package/dist/esm/keycloak/config.native.js +3 -4
- package/dist/esm/keycloak/config.native.js.map +1 -6
- package/dist/esm/keycloak/context.js.map +1 -1
- package/dist/esm/keycloak/context.mjs +2 -1
- package/dist/esm/keycloak/context.mjs.map +1 -0
- package/dist/esm/keycloak/context.native.js +3 -4
- package/dist/esm/keycloak/context.native.js.map +1 -6
- package/dist/esm/keycloak/index.mjs +2 -1
- package/dist/esm/keycloak/index.mjs.map +1 -0
- package/dist/esm/keycloak/index.native.js +3 -3
- package/dist/esm/keycloak/index.native.js.map +1 -6
- package/dist/esm/keycloak/keycloak.js +14 -11
- package/dist/esm/keycloak/keycloak.js.map +1 -1
- package/dist/esm/keycloak/keycloak.mjs +8 -7
- package/dist/esm/keycloak/keycloak.mjs.map +1 -0
- package/dist/esm/keycloak/keycloak.native.js +112 -317
- package/dist/esm/keycloak/keycloak.native.js.map +1 -6
- package/dist/esm/provider/AfterAuth.js +16 -8
- package/dist/esm/provider/AfterAuth.js.map +1 -1
- package/dist/esm/provider/AfterAuth.mjs +13 -8
- package/dist/esm/provider/AfterAuth.mjs.map +1 -0
- package/dist/esm/provider/AfterAuth.native.js +25 -30
- package/dist/esm/provider/AfterAuth.native.js.map +1 -6
- package/dist/esm/provider/AuthProvider/AuthProvider.js +56 -19
- package/dist/esm/provider/AuthProvider/AuthProvider.js.map +1 -1
- package/dist/esm/provider/AuthProvider/AuthProvider.mjs +21 -14
- package/dist/esm/provider/AuthProvider/AuthProvider.mjs.map +1 -0
- package/dist/esm/provider/AuthProvider/AuthProvider.native.js +104 -364
- package/dist/esm/provider/AuthProvider/AuthProvider.native.js.map +1 -6
- package/dist/esm/provider/AuthProvider/index.mjs +2 -1
- package/dist/esm/provider/AuthProvider/index.mjs.map +1 -0
- package/dist/esm/provider/AuthProvider/index.native.js +2 -2
- package/dist/esm/provider/AuthProvider/index.native.js.map +1 -6
- package/dist/esm/provider/KeycloakProvider.js +4 -1
- package/dist/esm/provider/KeycloakProvider.js.map +1 -1
- package/dist/esm/provider/KeycloakProvider.mjs +3 -2
- package/dist/esm/provider/KeycloakProvider.mjs.map +1 -0
- package/dist/esm/provider/KeycloakProvider.native.js +22 -17
- package/dist/esm/provider/KeycloakProvider.native.js.map +1 -6
- package/dist/esm/provider/index.mjs +3 -2
- package/dist/esm/provider/index.mjs.map +1 -0
- package/dist/esm/provider/index.native.js +3 -3
- package/dist/esm/provider/index.native.js.map +1 -6
- package/dist/esm/routes.js +11 -10
- package/dist/esm/routes.js.map +1 -1
- package/dist/esm/routes.mjs +12 -12
- package/dist/esm/routes.mjs.map +1 -0
- package/dist/esm/routes.native.js +98 -342
- package/dist/esm/routes.native.js.map +1 -6
- package/dist/esm/session/index.mjs +2 -1
- package/dist/esm/session/index.mjs.map +1 -0
- package/dist/esm/session/index.native.js +2 -2
- package/dist/esm/session/index.native.js.map +1 -6
- package/dist/esm/session/session.js.map +1 -1
- package/dist/esm/session/session.mjs +2 -1
- package/dist/esm/session/session.mjs.map +1 -0
- package/dist/esm/session/session.native.js +3 -126
- package/dist/esm/session/session.native.js.map +1 -6
- package/dist/esm/state.js +10 -14
- package/dist/esm/state.js.map +1 -1
- package/dist/esm/state.mjs +11 -14
- package/dist/esm/state.mjs.map +1 -0
- package/dist/esm/state.native.js +22 -15
- package/dist/esm/state.native.js.map +1 -6
- package/dist/esm/token.js.map +1 -1
- package/dist/esm/token.mjs +2 -1
- package/dist/esm/token.mjs.map +1 -0
- package/dist/esm/token.native.js +6 -8
- package/dist/esm/token.native.js.map +1 -6
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -1
- package/dist/esm/types.native.js.map +1 -6
- package/dist/jsx/Authenticated.js +11 -4
- package/dist/jsx/Authenticated.js.map +1 -1
- package/dist/jsx/Authenticated.mjs +7 -5
- package/dist/jsx/Authenticated.mjs.map +1 -0
- package/dist/jsx/Authenticated.native.js +7 -22
- package/dist/jsx/Authenticated.native.js.map +2 -2
- package/dist/jsx/Loading.js +11 -0
- package/dist/jsx/Loading.js.map +6 -0
- package/dist/jsx/Loading.mjs +16 -0
- package/dist/jsx/Loading.mjs.map +1 -0
- package/dist/jsx/Loading.native.js +13 -0
- package/dist/jsx/Loading.native.js.map +6 -0
- package/dist/jsx/authConfig.mjs +2 -1
- package/dist/jsx/authConfig.mjs.map +1 -0
- package/dist/jsx/hooks/index.mjs +3 -2
- package/dist/jsx/hooks/index.mjs.map +1 -0
- package/dist/jsx/hooks/useAuthConfig.mjs +2 -1
- package/dist/jsx/hooks/useAuthConfig.mjs.map +1 -0
- package/dist/jsx/hooks/useTokensFromQuery/index.mjs +2 -1
- package/dist/jsx/hooks/useTokensFromQuery/index.mjs.map +1 -0
- package/dist/jsx/hooks/useTokensFromState.js +6 -5
- package/dist/jsx/hooks/useTokensFromState.js.map +1 -1
- package/dist/jsx/hooks/useTokensFromState.mjs +6 -5
- package/dist/jsx/hooks/useTokensFromState.mjs.map +1 -0
- package/dist/jsx/hooks/useTokensFromState.native.js +6 -5
- package/dist/jsx/hooks/useTokensFromState.native.js.map +2 -2
- package/dist/jsx/index.mjs +6 -5
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/keycloak/config.mjs +2 -1
- package/dist/jsx/keycloak/config.mjs.map +1 -0
- package/dist/jsx/keycloak/context.js.map +1 -1
- package/dist/jsx/keycloak/context.mjs +2 -1
- package/dist/jsx/keycloak/context.mjs.map +1 -0
- package/dist/jsx/keycloak/context.native.js.map +1 -1
- package/dist/jsx/keycloak/index.mjs +2 -1
- package/dist/jsx/keycloak/index.mjs.map +1 -0
- package/dist/jsx/keycloak/keycloak.js +14 -11
- package/dist/jsx/keycloak/keycloak.js.map +1 -1
- package/dist/jsx/keycloak/keycloak.mjs +8 -7
- package/dist/jsx/keycloak/keycloak.mjs.map +1 -0
- package/dist/jsx/keycloak/keycloak.native.js +29 -211
- package/dist/jsx/keycloak/keycloak.native.js.map +2 -2
- package/dist/jsx/provider/AfterAuth.js +16 -8
- package/dist/jsx/provider/AfterAuth.js.map +1 -1
- package/dist/jsx/provider/AfterAuth.mjs +13 -8
- package/dist/jsx/provider/AfterAuth.mjs.map +1 -0
- package/dist/jsx/provider/AfterAuth.native.js +7 -4
- package/dist/jsx/provider/AfterAuth.native.js.map +2 -2
- package/dist/jsx/provider/AuthProvider/AuthProvider.js +56 -19
- package/dist/jsx/provider/AuthProvider/AuthProvider.js.map +1 -1
- package/dist/jsx/provider/AuthProvider/AuthProvider.mjs +21 -14
- package/dist/jsx/provider/AuthProvider/AuthProvider.mjs.map +1 -0
- package/dist/jsx/provider/AuthProvider/AuthProvider.native.js +84 -323
- package/dist/jsx/provider/AuthProvider/AuthProvider.native.js.map +2 -2
- package/dist/jsx/provider/AuthProvider/index.mjs +2 -1
- package/dist/jsx/provider/AuthProvider/index.mjs.map +1 -0
- package/dist/jsx/provider/KeycloakProvider.js +4 -1
- package/dist/jsx/provider/KeycloakProvider.js.map +1 -1
- package/dist/jsx/provider/KeycloakProvider.mjs +3 -2
- package/dist/jsx/provider/KeycloakProvider.mjs.map +1 -0
- package/dist/jsx/provider/KeycloakProvider.native.js +1 -1
- package/dist/jsx/provider/KeycloakProvider.native.js.map +1 -1
- package/dist/jsx/provider/index.mjs +3 -2
- package/dist/jsx/provider/index.mjs.map +1 -0
- package/dist/jsx/routes.js +11 -10
- package/dist/jsx/routes.js.map +1 -1
- package/dist/jsx/routes.mjs +12 -12
- package/dist/jsx/routes.mjs.map +1 -0
- package/dist/jsx/routes.native.js +89 -332
- package/dist/jsx/routes.native.js.map +2 -2
- package/dist/jsx/session/index.mjs +2 -1
- package/dist/jsx/session/index.mjs.map +1 -0
- package/dist/jsx/session/session.js.map +1 -1
- package/dist/jsx/session/session.mjs +2 -1
- package/dist/jsx/session/session.mjs.map +1 -0
- package/dist/jsx/session/session.native.js +2 -122
- package/dist/jsx/session/session.native.js.map +1 -1
- package/dist/jsx/state.js +10 -14
- package/dist/jsx/state.js.map +1 -1
- package/dist/jsx/state.mjs +11 -14
- package/dist/jsx/state.mjs.map +1 -0
- package/dist/jsx/state.native.js +19 -11
- package/dist/jsx/state.native.js.map +2 -2
- package/dist/jsx/token.js.map +1 -1
- package/dist/jsx/token.mjs +2 -1
- package/dist/jsx/token.mjs.map +1 -0
- package/dist/jsx/token.native.js +1 -1
- package/dist/jsx/token.native.js.map +1 -1
- package/dist/jsx/types.mjs +2 -0
- package/dist/jsx/types.mjs.map +1 -0
- package/package.json +12 -15
- package/routes/index.d.ts +1 -1
- package/routes/index.js +1 -1
- package/src/@types/expoKeycloakAuth.d.ts +1 -1
- package/src/Authenticated.tsx +41 -15
- package/src/Loading.tsx +37 -0
- package/src/authConfig.ts +2 -2
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useAuthConfig.ts +2 -2
- package/src/hooks/useTokensFromQuery/index.ts +4 -4
- package/src/hooks/useTokensFromState.ts +6 -5
- package/src/index.ts +7 -7
- package/src/keycloak/config.ts +6 -6
- package/src/keycloak/context.ts +3 -3
- package/src/keycloak/index.ts +2 -2
- package/src/keycloak/keycloak.native.ts +35 -27
- package/src/keycloak/keycloak.ts +48 -37
- package/src/provider/AfterAuth.tsx +33 -17
- package/src/provider/AuthProvider/AuthProvider.native.tsx +78 -29
- package/src/provider/AuthProvider/AuthProvider.tsx +143 -81
- package/src/provider/AuthProvider/index.ts +1 -1
- package/src/provider/KeycloakProvider.tsx +12 -9
- package/src/provider/index.ts +3 -3
- package/src/routes.ts +45 -35
- package/src/session/index.ts +1 -1
- package/src/session/session.native.ts +5 -3
- package/src/session/session.ts +14 -7
- package/src/state.ts +12 -16
- package/src/token.ts +9 -6
- package/types/Authenticated.d.ts +3 -3
- package/types/Authenticated.d.ts.map +1 -1
- package/types/Loading.d.ts +6 -0
- package/types/Loading.d.ts.map +1 -0
- package/types/hooks/index.d.ts +3 -3
- package/types/hooks/useTokensFromState.d.ts +1 -1
- package/types/hooks/useTokensFromState.d.ts.map +1 -1
- package/types/index.d.ts +7 -7
- package/types/keycloak/config.d.ts +1 -1
- package/types/keycloak/context.d.ts +1 -1
- package/types/keycloak/context.d.ts.map +1 -1
- package/types/keycloak/index.d.ts +2 -2
- package/types/keycloak/keycloak.d.ts +7 -7
- package/types/keycloak/keycloak.d.ts.map +1 -1
- package/types/keycloak/keycloak.native.d.ts +5 -5
- package/types/keycloak/keycloak.native.d.ts.map +1 -1
- package/types/provider/AfterAuth.d.ts +3 -3
- package/types/provider/AfterAuth.d.ts.map +1 -1
- package/types/provider/AuthProvider/AuthProvider.d.ts +8 -7
- package/types/provider/AuthProvider/AuthProvider.d.ts.map +1 -1
- package/types/provider/AuthProvider/AuthProvider.native.d.ts +3 -3
- package/types/provider/AuthProvider/AuthProvider.native.d.ts.map +1 -1
- package/types/provider/AuthProvider/index.d.ts +1 -1
- package/types/provider/KeycloakProvider.d.ts +4 -4
- package/types/provider/KeycloakProvider.d.ts.map +1 -1
- package/types/provider/index.d.ts +3 -3
- package/types/routes.d.ts +4 -4
- package/types/routes.d.ts.map +1 -1
- package/types/session/index.d.ts +1 -1
- package/types/session/session.d.ts +3 -3
- package/types/session/session.d.ts.map +1 -1
- package/types/session/session.native.d.ts +2 -2
- package/types/session/session.native.d.ts.map +1 -1
- package/types/state.d.ts +4 -6
- package/types/state.d.ts.map +1 -1
- package/types/token.d.ts +2 -2
- package/types/token.d.ts.map +1 -1
package/src/keycloak/config.ts
CHANGED
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
"use client";
|
|
23
23
|
|
|
24
|
-
import type { KeycloakConfig as KeycloakJsConfig } from
|
|
25
|
-
import { createContext } from
|
|
24
|
+
import type { KeycloakConfig as KeycloakJsConfig } from "keycloak-js";
|
|
25
|
+
import { createContext } from "react";
|
|
26
26
|
|
|
27
27
|
export interface KeycloakConfig extends KeycloakJsConfig {
|
|
28
28
|
publicClientId?: string;
|
|
@@ -30,7 +30,7 @@ export interface KeycloakConfig extends KeycloakJsConfig {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export const KeycloakConfigContext = createContext<KeycloakConfig>({
|
|
33
|
-
clientId:
|
|
34
|
-
realm:
|
|
35
|
-
url:
|
|
33
|
+
clientId: "",
|
|
34
|
+
realm: "",
|
|
35
|
+
url: "",
|
|
36
36
|
});
|
package/src/keycloak/context.ts
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
"use client";
|
|
23
23
|
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
24
|
+
import { createContext } from "react";
|
|
25
|
+
import type { Keycloak } from "./keycloak";
|
|
26
26
|
|
|
27
27
|
export const KeycloakContext = createContext<Keycloak | undefined>(undefined);
|
package/src/keycloak/index.ts
CHANGED
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
import type
|
|
24
|
-
import type { KeycloakConfig } from
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
22
|
+
import { jwtDecode } from "jwt-decode";
|
|
23
|
+
import type KeycloakClient from "keycloak-js";
|
|
24
|
+
import type { KeycloakConfig } from "keycloak-js";
|
|
25
|
+
import { MultiPlatform } from "multiplatform.one";
|
|
26
|
+
import { useContext } from "react";
|
|
27
|
+
import type { KeycloakLoginOptions, KeycloakLogoutOptions } from "../keycloak";
|
|
28
|
+
import { KeycloakConfigContext } from "../keycloak/config";
|
|
29
|
+
import type { AccessTokenParsed, TokenParsed } from "../token";
|
|
30
|
+
import type { KeycloakMock } from "../types";
|
|
31
|
+
import { KeycloakContext } from "./context";
|
|
32
32
|
|
|
33
33
|
export class Keycloak {
|
|
34
34
|
token?: string;
|
|
@@ -51,19 +51,21 @@ export class Keycloak {
|
|
|
51
51
|
login?: (_options: KeycloakLoginOptions) => Promise<undefined>,
|
|
52
52
|
logout?: (_options: KeycloakLogoutOptions) => Promise<undefined>,
|
|
53
53
|
) {
|
|
54
|
-
if (typeof input ===
|
|
54
|
+
if (typeof input === "string") {
|
|
55
55
|
this.token = input;
|
|
56
56
|
this.idToken = idToken;
|
|
57
57
|
this.refreshToken = refreshToken;
|
|
58
|
-
} else if (typeof input ===
|
|
59
|
-
if (typeof (input as KeycloakClient).init ===
|
|
58
|
+
} else if (typeof input === "object") {
|
|
59
|
+
if (typeof (input as KeycloakClient).init === "function") {
|
|
60
60
|
this.keycloakClient = input as KeycloakClient;
|
|
61
61
|
} else {
|
|
62
62
|
this.mock = input as KeycloakMock;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
if (this.token && !this._tokenParsed)
|
|
66
|
-
|
|
65
|
+
if (this.token && !this._tokenParsed)
|
|
66
|
+
this._tokenParsed = jwtDecode(this.token) as AccessTokenParsed;
|
|
67
|
+
if (this.idToken && !this._idTokenParsed)
|
|
68
|
+
this._idTokenParsed = jwtDecode(this.idToken) as TokenParsed;
|
|
67
69
|
if (this.refreshToken && !this._refreshTokenParsed) {
|
|
68
70
|
this._refreshTokenParsed = jwtDecode(this.refreshToken) as TokenParsed;
|
|
69
71
|
}
|
|
@@ -72,17 +74,20 @@ export class Keycloak {
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
get tokenParsed() {
|
|
75
|
-
if (this.keycloakClient)
|
|
77
|
+
if (this.keycloakClient)
|
|
78
|
+
return this.keycloakClient.tokenParsed as AccessTokenParsed;
|
|
76
79
|
return this._tokenParsed;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
get idTokenParsed() {
|
|
80
|
-
if (this.keycloakClient)
|
|
83
|
+
if (this.keycloakClient)
|
|
84
|
+
return this.keycloakClient.idTokenParsed as TokenParsed;
|
|
81
85
|
return this._idTokenParsed;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
get refreshTokenParsed() {
|
|
85
|
-
if (this.keycloakClient)
|
|
89
|
+
if (this.keycloakClient)
|
|
90
|
+
return this.keycloakClient.refreshTokenParsed as TokenParsed;
|
|
86
91
|
return this._refreshTokenParsed;
|
|
87
92
|
}
|
|
88
93
|
|
|
@@ -99,7 +104,7 @@ export class Keycloak {
|
|
|
99
104
|
|
|
100
105
|
get realm() {
|
|
101
106
|
if (this.keycloakClient) return this.keycloakClient.realm;
|
|
102
|
-
return this.tokenParsed?.iss?.split(
|
|
107
|
+
return this.tokenParsed?.iss?.split("/").pop() || this.config.realm;
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
get realmAccess() {
|
|
@@ -129,13 +134,16 @@ export class Keycloak {
|
|
|
129
134
|
|
|
130
135
|
async getUserInfo() {
|
|
131
136
|
if (!this.authenticated) return;
|
|
132
|
-
const response = await fetch(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
const response = await fetch(
|
|
138
|
+
`${this.config.url}/realms/${this.config.realm}/protocol/openid-connect/userinfo`,
|
|
139
|
+
{
|
|
140
|
+
method: "GET",
|
|
141
|
+
headers: {
|
|
142
|
+
Authorization: `Bearer ${this.token}`,
|
|
143
|
+
Accept: "application/json",
|
|
144
|
+
},
|
|
137
145
|
},
|
|
138
|
-
|
|
146
|
+
);
|
|
139
147
|
if (response.ok) return response.json();
|
|
140
148
|
}
|
|
141
149
|
|
|
@@ -175,8 +183,8 @@ export function useKeycloak() {
|
|
|
175
183
|
if (keycloak) return keycloak;
|
|
176
184
|
if (MultiPlatform.isStorybook) {
|
|
177
185
|
return new Keycloak(keycloakConfig, {
|
|
178
|
-
email:
|
|
179
|
-
username:
|
|
186
|
+
email: "storybook@example.com",
|
|
187
|
+
username: "storybook",
|
|
180
188
|
});
|
|
181
189
|
}
|
|
182
190
|
}
|
package/src/keycloak/keycloak.ts
CHANGED
|
@@ -19,25 +19,26 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import type
|
|
23
|
-
import
|
|
24
|
-
import type
|
|
25
|
-
import type { KeycloakMock } from '../types';
|
|
26
|
-
import type { Session } from '../session/session';
|
|
27
|
-
import { KeycloakConfigContext, type KeycloakConfig } from './config';
|
|
28
|
-
import { KeycloakContext } from './context';
|
|
29
|
-
import { MultiPlatform } from 'multiplatform.one';
|
|
30
|
-
import { useSession } from '../session/session';
|
|
31
|
-
import { jwtDecode } from 'jwt-decode';
|
|
32
|
-
import { signIn, signOut } from 'next-auth/react';
|
|
33
|
-
import { useAuthConfig } from '../hooks';
|
|
34
|
-
import { useContext } from 'react';
|
|
22
|
+
import type { AuthRequestPromptOptions } from "expo-auth-session";
|
|
23
|
+
import { jwtDecode } from "jwt-decode";
|
|
24
|
+
import type KeycloakClient from "keycloak-js";
|
|
35
25
|
import type {
|
|
36
26
|
KeycloakLoginOptions as KeycloakJsLoginOptions,
|
|
37
27
|
KeycloakLogoutOptions as KeycloakJsLogoutOptions,
|
|
38
|
-
} from
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
} from "keycloak-js";
|
|
29
|
+
import { MultiPlatform } from "multiplatform.one";
|
|
30
|
+
import { signIn, signOut } from "next-auth/react";
|
|
31
|
+
import { useContext } from "react";
|
|
32
|
+
import { useAuthConfig } from "../hooks";
|
|
33
|
+
import type { Session } from "../session/session";
|
|
34
|
+
import { useSession } from "../session/session";
|
|
35
|
+
import type { AccessTokenParsed, TokenParsed } from "../token";
|
|
36
|
+
import type { KeycloakMock } from "../types";
|
|
37
|
+
import { type KeycloakConfig, KeycloakConfigContext } from "./config";
|
|
38
|
+
import { KeycloakContext } from "./context";
|
|
39
|
+
|
|
40
|
+
export type KeycloakLoginOptions = KeycloakJsLoginOptions &
|
|
41
|
+
AuthRequestPromptOptions & { redirect?: boolean };
|
|
41
42
|
export type KeycloakLogoutOptions = KeycloakJsLogoutOptions;
|
|
42
43
|
|
|
43
44
|
export class Keycloak {
|
|
@@ -61,12 +62,12 @@ export class Keycloak {
|
|
|
61
62
|
login?: (_options: KeycloakLoginOptions) => Promise<undefined>,
|
|
62
63
|
logout?: (_options: KeycloakLogoutOptions) => Promise<undefined>,
|
|
63
64
|
) {
|
|
64
|
-
if (typeof input ===
|
|
65
|
+
if (typeof input === "string") {
|
|
65
66
|
this.token = input;
|
|
66
67
|
this.idToken = idToken;
|
|
67
68
|
this.refreshToken = refreshToken;
|
|
68
|
-
} else if (typeof input ===
|
|
69
|
-
if (typeof (input as KeycloakClient).init ===
|
|
69
|
+
} else if (typeof input === "object") {
|
|
70
|
+
if (typeof (input as KeycloakClient).init === "function") {
|
|
70
71
|
this.keycloakClient = input as KeycloakClient;
|
|
71
72
|
} else if ((input as Session).accessToken) {
|
|
72
73
|
const session = input as Session;
|
|
@@ -77,8 +78,10 @@ export class Keycloak {
|
|
|
77
78
|
this.mock = input as KeycloakMock;
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
if (this.token && !this._tokenParsed)
|
|
81
|
-
|
|
81
|
+
if (this.token && !this._tokenParsed)
|
|
82
|
+
this._tokenParsed = jwtDecode(this.token) as AccessTokenParsed;
|
|
83
|
+
if (this.idToken && !this._idTokenParsed)
|
|
84
|
+
this._idTokenParsed = jwtDecode(this.idToken) as TokenParsed;
|
|
82
85
|
if (this.refreshToken && !this._refreshTokenParsed) {
|
|
83
86
|
this._refreshTokenParsed = jwtDecode(this.refreshToken) as TokenParsed;
|
|
84
87
|
}
|
|
@@ -87,17 +90,20 @@ export class Keycloak {
|
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
get tokenParsed() {
|
|
90
|
-
if (this.keycloakClient)
|
|
93
|
+
if (this.keycloakClient)
|
|
94
|
+
return this.keycloakClient.tokenParsed as AccessTokenParsed;
|
|
91
95
|
return this._tokenParsed;
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
get idTokenParsed() {
|
|
95
|
-
if (this.keycloakClient)
|
|
99
|
+
if (this.keycloakClient)
|
|
100
|
+
return this.keycloakClient.idTokenParsed as TokenParsed;
|
|
96
101
|
return this._idTokenParsed;
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
get refreshTokenParsed() {
|
|
100
|
-
if (this.keycloakClient)
|
|
105
|
+
if (this.keycloakClient)
|
|
106
|
+
return this.keycloakClient.refreshTokenParsed as TokenParsed;
|
|
101
107
|
return this._refreshTokenParsed;
|
|
102
108
|
}
|
|
103
109
|
|
|
@@ -114,7 +120,7 @@ export class Keycloak {
|
|
|
114
120
|
|
|
115
121
|
get realm() {
|
|
116
122
|
if (this.keycloakClient) return this.keycloakClient.realm;
|
|
117
|
-
return this.tokenParsed?.iss?.split(
|
|
123
|
+
return this.tokenParsed?.iss?.split("/").pop() || this.config.realm;
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
get realmAccess() {
|
|
@@ -144,13 +150,16 @@ export class Keycloak {
|
|
|
144
150
|
|
|
145
151
|
async getUserInfo() {
|
|
146
152
|
if (!this.authenticated) return;
|
|
147
|
-
const response = await fetch(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
const response = await fetch(
|
|
154
|
+
`${this.config.url}/realms/${this.config.realm}/protocol/openid-connect/userinfo`,
|
|
155
|
+
{
|
|
156
|
+
method: "GET",
|
|
157
|
+
headers: {
|
|
158
|
+
Authorization: `Bearer ${this.token}`,
|
|
159
|
+
Accept: "application/json",
|
|
160
|
+
},
|
|
152
161
|
},
|
|
153
|
-
|
|
162
|
+
);
|
|
154
163
|
if (response.ok) return response.json();
|
|
155
164
|
}
|
|
156
165
|
|
|
@@ -161,7 +170,7 @@ export class Keycloak {
|
|
|
161
170
|
if (this.keycloakClient) {
|
|
162
171
|
await this.keycloakClient.login(options);
|
|
163
172
|
} else if (MultiPlatform.isNext && !MultiPlatform.isServer) {
|
|
164
|
-
await signIn(
|
|
173
|
+
await signIn("keycloak", {
|
|
165
174
|
callbackUrl: options.redirectUri,
|
|
166
175
|
redirect: options.redirect,
|
|
167
176
|
});
|
|
@@ -177,7 +186,7 @@ export class Keycloak {
|
|
|
177
186
|
if (this.keycloakClient) {
|
|
178
187
|
await this.keycloakClient.logout(options);
|
|
179
188
|
} else if (MultiPlatform.isNext && !MultiPlatform.isServer) {
|
|
180
|
-
await fetch(
|
|
189
|
+
await fetch("/api/auth/logout", { method: "GET" });
|
|
181
190
|
await signOut({
|
|
182
191
|
callbackUrl: options.redirectUri,
|
|
183
192
|
});
|
|
@@ -203,12 +212,14 @@ export function useKeycloak() {
|
|
|
203
212
|
const { session, status } = useSession();
|
|
204
213
|
if (MultiPlatform.isStorybook) {
|
|
205
214
|
return new Keycloak(keycloakConfig, {
|
|
206
|
-
email:
|
|
207
|
-
username:
|
|
215
|
+
email: "storybook@example.com",
|
|
216
|
+
username: "storybook",
|
|
208
217
|
});
|
|
209
|
-
}
|
|
218
|
+
}
|
|
219
|
+
if (status === "unauthenticated") {
|
|
210
220
|
return new Keycloak(keycloakConfig);
|
|
211
|
-
}
|
|
221
|
+
}
|
|
222
|
+
if (status === "authenticated" && session?.accessToken) {
|
|
212
223
|
return new Keycloak(keycloakConfig, session as Session);
|
|
213
224
|
}
|
|
214
225
|
}
|
|
@@ -19,46 +19,62 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
"use client";
|
|
23
23
|
|
|
24
|
-
import React, {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
import React, {
|
|
25
|
+
type ComponentType,
|
|
26
|
+
type PropsWithChildren,
|
|
27
|
+
useEffect,
|
|
28
|
+
} from "react";
|
|
29
|
+
import { Loading } from "../Loading";
|
|
30
|
+
import { useAuthConfig } from "../hooks";
|
|
31
|
+
import { useKeycloak } from "../keycloak";
|
|
32
|
+
import { persist, useAuthStore } from "../state";
|
|
29
33
|
|
|
30
|
-
export interface AfterAuthProps extends PropsWithChildren {
|
|
34
|
+
export interface AfterAuthProps extends PropsWithChildren {
|
|
35
|
+
loadingComponent?: ComponentType;
|
|
36
|
+
}
|
|
31
37
|
|
|
32
38
|
const logger = console;
|
|
33
39
|
|
|
34
|
-
export function AfterAuth({ children }: AfterAuthProps) {
|
|
40
|
+
export function AfterAuth({ children, loadingComponent }: AfterAuthProps) {
|
|
35
41
|
const authConfig = useAuthConfig();
|
|
36
|
-
const
|
|
42
|
+
const authStore = useAuthStore();
|
|
37
43
|
const keycloak = useKeycloak();
|
|
44
|
+
if (!authStore) return <Loading loadingComponent={loadingComponent} />;
|
|
38
45
|
|
|
39
46
|
useEffect(() => {
|
|
40
47
|
if (!persist || !keycloak?.authenticated) return;
|
|
41
48
|
if (keycloak.token) {
|
|
42
|
-
|
|
43
|
-
if (keycloak.idToken)
|
|
44
|
-
if (keycloak.refreshToken)
|
|
49
|
+
authStore.token = keycloak.token;
|
|
50
|
+
if (keycloak.idToken) authStore.idToken = keycloak.idToken;
|
|
51
|
+
if (keycloak.refreshToken) authStore.refreshToken = keycloak.refreshToken;
|
|
45
52
|
}
|
|
46
|
-
}, [
|
|
53
|
+
}, [
|
|
54
|
+
keycloak?.authenticated,
|
|
55
|
+
keycloak?.token,
|
|
56
|
+
keycloak?.idToken,
|
|
57
|
+
keycloak?.refreshToken,
|
|
58
|
+
]);
|
|
47
59
|
|
|
48
60
|
useEffect(() => {
|
|
49
|
-
if (authConfig.debug && keycloak?.token)
|
|
61
|
+
if (authConfig.debug && keycloak?.token)
|
|
62
|
+
logger.debug("token", keycloak.token);
|
|
50
63
|
}, [keycloak?.token]);
|
|
51
64
|
|
|
52
65
|
useEffect(() => {
|
|
53
|
-
if (authConfig.debug && keycloak?.idToken)
|
|
66
|
+
if (authConfig.debug && keycloak?.idToken)
|
|
67
|
+
logger.debug("idToken", keycloak.idToken);
|
|
54
68
|
}, [keycloak?.idToken]);
|
|
55
69
|
|
|
56
70
|
useEffect(() => {
|
|
57
|
-
if (authConfig.debug && keycloak?.refreshToken)
|
|
71
|
+
if (authConfig.debug && keycloak?.refreshToken)
|
|
72
|
+
logger.debug("refreshToken", keycloak.refreshToken);
|
|
58
73
|
}, [keycloak?.refreshToken]);
|
|
59
74
|
|
|
60
75
|
useEffect(() => {
|
|
61
|
-
if (authConfig.debug && keycloak?.authenticated)
|
|
76
|
+
if (authConfig.debug && keycloak?.authenticated)
|
|
77
|
+
logger.debug("authenticated", keycloak.authenticated);
|
|
62
78
|
}, [keycloak?.authenticated]);
|
|
63
79
|
|
|
64
80
|
return <>{children}</>;
|
|
@@ -19,33 +19,65 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
exchangeCodeAsync,
|
|
24
|
+
makeRedirectUri,
|
|
25
|
+
refreshAsync,
|
|
26
|
+
useAuthRequest,
|
|
27
|
+
useAutoDiscovery,
|
|
28
|
+
} from "expo-auth-session";
|
|
29
|
+
import React, { useState, useEffect, useMemo, useCallback } from "react";
|
|
30
|
+
import { Loading } from "../../Loading";
|
|
31
|
+
import { Keycloak, KeycloakConfigContext } from "../../keycloak";
|
|
32
|
+
import type {
|
|
33
|
+
KeycloakLoginOptions,
|
|
34
|
+
KeycloakLogoutOptions,
|
|
35
|
+
} from "../../keycloak";
|
|
36
|
+
import { KeycloakContext } from "../../keycloak/context";
|
|
37
|
+
import { persist, useAuthStore } from "../../state";
|
|
38
|
+
import { isTokenExpired, validOrRefreshableToken } from "../../token";
|
|
39
|
+
import { AfterAuth } from "../AfterAuth";
|
|
40
|
+
import type { AuthProviderProps, Tokens } from "./AuthProvider";
|
|
31
41
|
|
|
32
42
|
const REFRESH_THRESHOLD = 5;
|
|
33
43
|
|
|
34
|
-
export function AuthProvider({
|
|
44
|
+
export function AuthProvider({
|
|
45
|
+
children,
|
|
46
|
+
keycloakConfig,
|
|
47
|
+
loadingComponent,
|
|
48
|
+
}: AuthProviderProps) {
|
|
35
49
|
const [keycloak, setKeycloak] = useState<Keycloak>();
|
|
36
|
-
const
|
|
37
|
-
|
|
50
|
+
const authStore = useAuthStore();
|
|
51
|
+
if (!authStore) return <Loading loadingComponent={loadingComponent} />;
|
|
52
|
+
const initialRefreshToken = useMemo(
|
|
53
|
+
() => validOrRefreshableToken((persist && authStore.refreshToken) || false),
|
|
54
|
+
[],
|
|
55
|
+
);
|
|
38
56
|
const keycloakUrl = `${keycloakConfig?.url}/realms/${keycloakConfig?.realm}`;
|
|
39
|
-
const clientId =
|
|
57
|
+
const clientId =
|
|
58
|
+
keycloakConfig.publicClientId || keycloakConfig?.clientId || "";
|
|
40
59
|
const discovery = useAutoDiscovery(keycloakUrl);
|
|
41
60
|
const redirectUri = makeRedirectUri();
|
|
42
61
|
const [tokens, setTokens] = useState<Tokens<false>>({
|
|
43
62
|
refreshToken: initialRefreshToken,
|
|
44
|
-
token: validOrRefreshableToken(
|
|
45
|
-
|
|
63
|
+
token: validOrRefreshableToken(
|
|
64
|
+
(persist && authStore.token) || false,
|
|
65
|
+
initialRefreshToken,
|
|
66
|
+
),
|
|
67
|
+
idToken: validOrRefreshableToken(
|
|
68
|
+
(persist && authStore.idToken) || false,
|
|
69
|
+
initialRefreshToken,
|
|
70
|
+
),
|
|
46
71
|
});
|
|
47
72
|
const scopes = useMemo(
|
|
48
|
-
() => [
|
|
73
|
+
() => [
|
|
74
|
+
...new Set([
|
|
75
|
+
"email",
|
|
76
|
+
"openid",
|
|
77
|
+
"profile",
|
|
78
|
+
...(keycloakConfig.scopes || []),
|
|
79
|
+
]),
|
|
80
|
+
],
|
|
49
81
|
[keycloakConfig.scopes],
|
|
50
82
|
);
|
|
51
83
|
const [request, response, promptAsync] = useAuthRequest(
|
|
@@ -58,9 +90,14 @@ export function AuthProvider({ children, keycloakConfig }: AuthProviderProps) {
|
|
|
58
90
|
);
|
|
59
91
|
|
|
60
92
|
useEffect(() => {
|
|
61
|
-
if (!discovery || !response?.type || !request?.codeVerifier || !clientId)
|
|
93
|
+
if (!discovery || !response?.type || !request?.codeVerifier || !clientId)
|
|
94
|
+
return;
|
|
62
95
|
(async () => {
|
|
63
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
response?.type === "success" &&
|
|
98
|
+
request.codeVerifier &&
|
|
99
|
+
response.params.code
|
|
100
|
+
) {
|
|
64
101
|
const tokenResponse = await exchangeCodeAsync(
|
|
65
102
|
{
|
|
66
103
|
clientId,
|
|
@@ -85,16 +122,16 @@ export function AuthProvider({ children, keycloakConfig }: AuthProviderProps) {
|
|
|
85
122
|
}, [
|
|
86
123
|
!discovery,
|
|
87
124
|
request?.codeVerifier,
|
|
88
|
-
response?.type ===
|
|
125
|
+
response?.type === "success" ? response?.params?.code : undefined,
|
|
89
126
|
clientId,
|
|
90
127
|
scopes,
|
|
91
128
|
redirectUri,
|
|
92
129
|
]);
|
|
93
130
|
|
|
94
131
|
const resetTokens = useCallback(() => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
132
|
+
authStore.idToken = "";
|
|
133
|
+
authStore.refreshToken = "";
|
|
134
|
+
authStore.token = "";
|
|
98
135
|
setTokens({
|
|
99
136
|
refreshToken: undefined,
|
|
100
137
|
token: undefined,
|
|
@@ -104,7 +141,7 @@ export function AuthProvider({ children, keycloakConfig }: AuthProviderProps) {
|
|
|
104
141
|
|
|
105
142
|
const refreshTokens = useCallback(async () => {
|
|
106
143
|
if (!discovery) return;
|
|
107
|
-
if (typeof tokens.refreshToken ===
|
|
144
|
+
if (typeof tokens.refreshToken === "string") {
|
|
108
145
|
if (!isTokenExpired(tokens.refreshToken)) {
|
|
109
146
|
const tokenResponse = await refreshAsync(
|
|
110
147
|
{
|
|
@@ -127,9 +164,9 @@ export function AuthProvider({ children, keycloakConfig }: AuthProviderProps) {
|
|
|
127
164
|
resetTokens();
|
|
128
165
|
}
|
|
129
166
|
} else if (
|
|
130
|
-
|
|
131
|
-
typeof
|
|
132
|
-
isTokenExpired(
|
|
167
|
+
authStore.refreshToken &&
|
|
168
|
+
typeof authStore.refreshToken === "string" &&
|
|
169
|
+
isTokenExpired(authStore.refreshToken)
|
|
133
170
|
) {
|
|
134
171
|
resetTokens();
|
|
135
172
|
}
|
|
@@ -162,7 +199,10 @@ export function AuthProvider({ children, keycloakConfig }: AuthProviderProps) {
|
|
|
162
199
|
if (_keycloak.tokenParsed?.exp) {
|
|
163
200
|
const timeout =
|
|
164
201
|
Math.max(
|
|
165
|
-
Math.min(
|
|
202
|
+
Math.min(
|
|
203
|
+
_keycloak.tokenParsed.exp,
|
|
204
|
+
_keycloak.refreshTokenParsed?.exp || 0,
|
|
205
|
+
) -
|
|
166
206
|
Math.floor(Date.now() / 1000) -
|
|
167
207
|
REFRESH_THRESHOLD,
|
|
168
208
|
REFRESH_THRESHOLD,
|
|
@@ -172,7 +212,10 @@ export function AuthProvider({ children, keycloakConfig }: AuthProviderProps) {
|
|
|
172
212
|
refreshTokens();
|
|
173
213
|
}, timeout);
|
|
174
214
|
} else {
|
|
175
|
-
setTimeout(
|
|
215
|
+
setTimeout(
|
|
216
|
+
() => _keycloak.logout(),
|
|
217
|
+
Math.max(0, timeout + REFRESH_THRESHOLD) * 1000,
|
|
218
|
+
);
|
|
176
219
|
return;
|
|
177
220
|
}
|
|
178
221
|
}
|
|
@@ -182,7 +225,13 @@ export function AuthProvider({ children, keycloakConfig }: AuthProviderProps) {
|
|
|
182
225
|
return () => {
|
|
183
226
|
if (refreshHandle) clearTimeout(refreshHandle);
|
|
184
227
|
};
|
|
185
|
-
}, [
|
|
228
|
+
}, [
|
|
229
|
+
!request,
|
|
230
|
+
tokens.token,
|
|
231
|
+
tokens.idToken,
|
|
232
|
+
tokens.refreshToken,
|
|
233
|
+
refreshTokens,
|
|
234
|
+
]);
|
|
186
235
|
|
|
187
236
|
return (
|
|
188
237
|
<KeycloakConfigContext.Provider value={keycloakConfig}>
|