okta/okta-auth-js

Login via social login with getWithPopup failing on Facebooks MFA request

Opened this issue · 0 comments

Describe the bug

We use this library for allowing users to login via Facebook.

The code looks something like this:

return oktaAuthClient.token
    .getWithPopup({
      display: 'popup',
      idp: facebookIdp,
      prompt: 'login',
      redirectUri: `${window.location.origin}${redirectUri}`,
      responseType: 'id_token',
    });

This has worked for years correctly. However, now when Facebook asks for your MFA code, the main window throws an error:

getToken.js:88 Uncaught (in promise) AuthSdkError: Unable to parse OAuth flow response
    at eval (getToken.js:88:1)

And when the client finally clicks to allow, upon returning to window it throws this error:

redirect?stateToken=02.id.X...K:39 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://login.MYDOMAIN.net') does not match the recipient window's origin ('https://MY-TENANT.oktapreview.com').

If the user already has entered the MFA codes, this issue does not happen, and it returns to the window, and the user is logged in.

Reproduction Steps?

See description.

It seems the error is in getToken

              if (!popupWindow || popupWindow.closed) {
                clearInterval(closePoller);
                reject(new AuthSdkError('Unable to parse OAuth flow response'));
              }

I have added a breakpoint, and it is failing because the popupWindow is closed. Something about the Facebook mfa request is causing the sdk to think the popup window is closed.

SDK Versions

we are on version 7.7.0 of this library.

Additional Information?

I have reported this to okta support also, but they have not provided any info so far.

I am reporting to you since it does seem to be in this SDK's understanding of the popup window.

This changed within the last couple days with no change on our part.

If this is not an appropriate place for reporting this issue, please accept my apologies.