isAuthenticated of useAuth0 is too slow, why?

We are using @auth0/auth0-react in our React app.
After login, it takes about 10 seconds for isAuthenticated of useAuth0 to become true.
Why is it taking so long?
Is there anything I can do to improve this?

  • Which SDK this is regarding:
    @auth0/auth0-react

  • SDK Version:
    ^1.3.0

  • Platform Version:
    react: 17.0.1

import { Loading } from '@/components/feedback/Loading';
import { useAuth0 } from '@auth0/auth0-react';
import React, { useContext, useEffect } from 'react';

export const LoginRestrictedRoute = ({ children }) => {
  const { isAuthenticated, isLoading, loginWithRedirect } = useAuth0();

  useEffect(() => {
    if (!isLoading && !isAuthenticated) {
     loginWithRedirect({
        appState: {
          targetUrl: window.location.href,
        },
      });
    }
  }, [isLoading, isAuthenticated]);

  if (isLoading || !isAuthenticated) {
    return <Loading loading={isLoading} size="large" />;
  }

  return children;
};

Hey there!

Can you open this as a GitHub issue in our react repo so we can get that addressed directly with the SDK maintainers? Once you have a link to it please share it here so we can ping them. Thank you!

I’ve created an Issue here.

Perfect! I’ll ping them in a minute!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.