@multiplatform.one/keycloak 0.3.18 → 0.3.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/keycloak",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
4
4
  "description": "keycloak client for multiplatform.one ecosystem",
5
5
  "main": "dist/lib",
6
6
  "module": "dist/esm",
@@ -83,7 +83,7 @@
83
83
  "jest-sonar-reporter": "^2.0.0",
84
84
  "lockfile-lint": "^4.10.5",
85
85
  "multiplatform.one": "^0.5.41",
86
- "next": "^13.4.3",
86
+ "next": "^13.4.4",
87
87
  "prettier": "^2.8.8",
88
88
  "react": "^18.2.0",
89
89
  "react-native": "~0.71.8",
@@ -26,7 +26,7 @@ import React, { useEffect } from 'react';
26
26
  import type { ComponentType, ReactNode } from 'react';
27
27
  import { useLogin, useKeycloak } from './hooks';
28
28
  import { useAuthState } from './state';
29
- import { useAuthConfig } from './hooks/useAuthConfig';
29
+ import { useAuthConfig, useTokensFromQuery, useTokensFromState } from './hooks';
30
30
 
31
31
  export interface AuthenticatedProps {
32
32
  children: ReactNode;
@@ -39,6 +39,8 @@ export function Authenticated({ children, disabled, loginRoute, loggedOutCompone
39
39
  const authConfig = useAuthConfig();
40
40
  const authState = useAuthState();
41
41
  const login = useLogin(loginRoute);
42
+ const tokensFromQuery = useTokensFromQuery();
43
+ const tokensFromState = useTokensFromState();
42
44
  const { authenticated } = useKeycloak();
43
45
 
44
46
  useEffect(() => {
@@ -48,7 +50,7 @@ export function Authenticated({ children, disabled, loginRoute, loggedOutCompone
48
50
  authState.setRefreshToken('');
49
51
  authState.setToken('');
50
52
  }
51
- login();
53
+ if (typeof window !== 'undefined' && !tokensFromQuery && !tokensFromState) login();
52
54
  }, [authenticated]);
53
55
 
54
56
  if (disabled || authenticated) return <>{children}</>;
@@ -4,7 +4,7 @@
4
4
  * File Created: 08-11-2022 06:34:56
5
5
  * Author: Clay Risser
6
6
  * -----
7
- * Last Modified: 16-05-2023 07:40:57
7
+ * Last Modified: 26-05-2023 07:00:31
8
8
  * Modified By: Clay Risser
9
9
  * -----
10
10
  * Risser Labs LLC (c) Copyright 2021 - 2022
@@ -22,6 +22,7 @@
22
22
  * limitations under the License.
23
23
  */
24
24
 
25
+ export * from './useAuthConfig';
25
26
  export * from './useCurrentRouteName';
26
27
  export * from './useKeycloak';
27
28
  export * from './useLogin';
@@ -256,7 +256,7 @@ export function KeycloakProvider({
256
256
  </SSRKeycloakProvider>
257
257
  );
258
258
  }
259
- if (!keycloak) return <>{children}</>;
259
+ if (!keycloak) return <LoadingComponent />;
260
260
  return (
261
261
  <ReactKeycloakProvider
262
262
  LoadingComponent={<LoadingComponent />}