4

I am working on a login page (using react) where I want to use loginwithPopup() from auth0. I have used the sample react SPA code from GitHub which is provided by auth0. They have used loginWithRedirect in their example under NavBar component but I want to use loginWithPopup(). for some strange reasons it doesn't work and continuously throws misconfiguration error, however, it works with loginWithRedirect() without any trouble. Can I have a sample working code using loginWithPopup() for auth0 SPA?

const {loginWithPopup } = useAuth0; //useAuth0 from react-auth0-spa.js file
const login = async () => {
        await loginWithPopup({}); // In addition I want to redirect to localhost:3000/homePage
    }

    return (
        <div>
            <button onClick={login}> log in </button>
        </div>
    );
Rishiban R
  • 103
  • 2
  • 14
  • There may be an issue with how you've configured auth0-client. – Amir May 26 '21 at 16:36
  • You need to go into your Auth0 application settings. You can also view the logs in Auth0, sometimes it will tell you what's wrong. Check your CORS settings, allowed web origins etc. – The Muffin Man Jan 29 '23 at 23:07

0 Answers0