Auth0 JS - signupAndAuthorize not logging in?

Hey! I have used signupAndAuthorize, it logs in the user and returns what is needed but when I invoke checkSession shortly after it returns with an error login_required

Hi @00dev,

Welcome to the Auth0 Community!

Please see these two links for what to do when the login_required error is returned:

Let me know if you have any additional questions!

Thanks,

Mary Beth

Hey, None of these seem to be my issue because the silent auth works perfectly after login it only happens with signupAndAuthorize

Hi @00dev,

Thanks for your reply! Can you kindly provide a screenshot or code snippet of the signupAndAuthorize implementation?

Thanks,

Mary Beth

Here you go, I am only using localstorage for test purposes.

webAuth.signupAndAuthorize(
        {
          connection: 'Username-Password-Authentication',
          email,
          password,
          user_metadata: { phone },
        },
        (err, result) => {
          if (err) {
            console.error('Signup error:', err);
            let errorMessage = err.message || err.description || 'Something went wrong, please try again later.';
            showErrorPopup(errorMessage);
            
            toggleButtonState(form, false);
            return;
          }

          console.log('Signup success:', result);

 
          const { accessToken, idToken } = result;

          if (!accessToken || !idToken) {
            console.error('Missing tokens in the signupAndAuthorize result.');
            alert('Signup succeeded, but login failed to generate tokens.');
            return;
          }
    
   
          localStorage.setItem('access_token', accessToken);
          localStorage.setItem('id_token', idToken);

          window.location.href = '/home';
        }
      );

Hey, Still waiting on a reply from the implementation.