## The problem

With Frontegg hosted login in @frontegg/react v7, setting loadUserOnFirstLoad to true broke loginWithRedirect: instead of going to the Frontegg domain, the app redirected to YOUR_HOST:3000/account/login and showed an error after entering the email. The cause was using the useAuthUser hook, which is meant for embedded login and auto-redirects when the user is null; it is not supported in hosted login mode. Nothing in the app code was wrong beyond the choice of hook, so the redirect looped to the local route instead of the Frontegg domain.

## What fixed it

In hosted login mode use useAuthUserOrNull instead of useAuthUser; the latter is only for embedded login and its automatic redirect is what sent you to /account/login. The reporter confirmed swapping the hook resolved the redirect. Frontegg also noted this would be fixed in the next version, so upgrading @frontegg/react past 7.0.1 is worthwhile too.