diff --git a/packages/ra-core/src/auth/useGetIdentity.ts b/packages/ra-core/src/auth/useGetIdentity.ts index 36fec18a828..7a46ad3375a 100644 --- a/packages/ra-core/src/auth/useGetIdentity.ts +++ b/packages/ra-core/src/auth/useGetIdentity.ts @@ -45,7 +45,7 @@ const useGetIdentity = () => { }); const authProvider = useAuthProvider(); useEffect(() => { - if (typeof authProvider.getIdentity === 'function') { + if (authProvider && typeof authProvider.getIdentity === 'function') { const callAuthProvider = async () => { try { const identity = await authProvider.getIdentity();