okta / okta-signin-widget

HTML/CSS/JS widget that provides out-of-the-box authentication UX for your organization's apps
Other
376 stars 319 forks source link

showSignInToGetTokens is resolved with undefined tokens on successful registration #1660

Open Kano098 opened 3 years ago

Kano098 commented 3 years ago

I'm submitting a

Background info

Unable to login after successful registration

Expected behavior

showSignInToGetTokens is only resolved on successful authentication

What went wrong?

showSignInToGetTokens is resolved on successful registration

Steps to reproduce

  1. Initialize widget with features.registration: true
  2. Go to the registration page
  3. Create new user
  4. On the "Verify email" page click the "Back to login" button
  5. Try to login

Nothing happens because the returning promise of showSignInToGetTokens has been already resolved on successful registration(step 3)

Your environment

oleksandrpravosudko-okta commented 3 years ago

Thanks for report @Kano098.

Logging issue to be prioritised: Internal Ref: OKTA-369549

In meantime, you could try using the below workaround using renderEl (given it suits your needs):

widget.renderEl({
      el: widgetRef.current,
    }).then((res) => {
      if (res.status === 'SUCCESS') {
      // user is authenticated
        oktaAuth.handleLoginRedirect(res.tokens);
      } else if (res.status === 'ACTIVATION_EMAIL_SENT') {
        // setActivationEmailSent(true);
        // OR
        // window.location.assign('/registrationComplete')
      }
 );