@orsetra/shared-auth 1.0.7 → 1.0.8

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.
@@ -27,14 +27,13 @@ interface SessionProviderProps {
27
27
  export function SessionProvider({ children, config }: SessionProviderProps) {
28
28
  const [user, setUser] = useState<User | null>(null)
29
29
  const [isLoading, setIsLoading] = useState(true)
30
- const [isConfigured, setIsConfigured] = useState(false)
31
- // Configure auth synchronously before any render
32
- if (!ZitadelAuthService.isConfigured()) {
33
- ZitadelAuthService.configureAuth(config)
34
- setIsConfigured(true)
35
- }
36
30
 
37
31
  useEffect(() => {
32
+ // Configure auth only on client side
33
+ if (!ZitadelAuthService.isConfigured()) {
34
+ ZitadelAuthService.configureAuth(config)
35
+ }
36
+
38
37
  const loadUser = async () => {
39
38
  try {
40
39
  const currentUser = await ZitadelAuthService.getUser()
@@ -50,7 +49,7 @@ export function SessionProvider({ children, config }: SessionProviderProps) {
50
49
  }, [config])
51
50
 
52
51
  const logout = async () => {
53
- if (!isConfigured) return
52
+ if (!ZitadelAuthService.isConfigured()) return
54
53
  await ZitadelAuthService.signOut()
55
54
  setUser(null)
56
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orsetra/shared-auth",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Shared authentication utilities for Orsetra platform using Zitadel",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",