From ac83aebfc4573474915a91e8622b5d67ea7ff78c Mon Sep 17 00:00:00 2001 From: dtoxvanilla1991 Date: Tue, 5 Aug 2025 17:38:04 +0100 Subject: [PATCH] Ensures auth check happens before other logic initRef.current flag was being set after an asynchronous call (await checkAuth(...)), both invocations of init could proceed before the flag was updated, leading to the exchangeAuthCode function being called twice. --- src/state/KindeProvider.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state/KindeProvider.tsx b/src/state/KindeProvider.tsx index ccc3d26..34c98e8 100644 --- a/src/state/KindeProvider.tsx +++ b/src/state/KindeProvider.tsx @@ -552,8 +552,8 @@ export const KindeProvider = ({ const init = useCallback(async () => { if (initRef.current) return; - await checkAuth({ domain, clientId }); initRef.current = true; + await checkAuth({ domain, clientId }); const params = new URLSearchParams(window.location.search); if (params.has("error")) {