djbalinD
Convex Communityโ€ข2y agoโ€ข
5 replies
djbalin

[Convex Auth]: signIn doesn't set isAuthenticated to true immediately

Hi, as the title suggests, signIn doesn't seem to set isAuthenticated immediately after the resolution of its promise.

For example, this snippet of our AuthProvider:
const { isAuthenticated, isLoading } = useConvexAuth();
const signInResult = await signIn('password', {
      flow: 'email-verification',
      email,
      code,
    });
    console.log('Confirm otp, signinresult: ', signInResult);
    console.log('confirm otp done. isAuthenticated: ', isAuthenticated);


We have isAuthenticated as false even after awaiting the successful signIn. This causes our redirection to mess up, since when isLoading resolves to false, isAuthenticated is also still false despite the user having just logged in.

This doesn't seem intentional - after successful signIn, the next {isLoading, isAuthenticated} pair should resolve to a truthy authentication status, no?

Thank you ๐Ÿ™‚
Was this page helpful?