Skip to content

Webviews are not authenticated when using accounts with 2FA enabled in development mode #15739

@fluiddot

Description

@fluiddot

Expected behavior

Webviews should be authenticated and show the content from the site.

Actual behavior

Webviews are not authenticated and request the user to log in.

Here are some examples of different webviews tested in public and private sites:

Private site

View a post
view-post-private-site.mp4
Edit unsupported block
edit-unsupported-block-private-site.mp4

Public site

View a post
view-post-public-site.mp4
Edit unsupported block
edit-unsupported-block-public-site.mp4

Steps to reproduce the behavior

I managed to reproduce this on an iOS simulator and in different webviews.

View a post (private site)

  1. Remove the app (if it was already installed)
  2. Install the app
  3. Log in with an account that has 2FA enabled
  4. Go to a private site
  5. Go to Posts
  6. Tap on View button of one post
  7. The webview doesn't show the post, instead it has the message Private Site and requests the user to log in.

The steps for reproducing it in a public site are the same.

Edit unsupported block

This test flow requires a quick set up to be done in WordPress.com:

  1. Go to a private site
  2. Create a post
  3. Add a block that is not supported by the native editor like GIF block
  4. Save the post

Then on a device:

  1. Remove the app (if it was already installed)
  2. Install the app
  3. Log in with an account that has 2FA enabled
  4. Go to the post previously created
  5. Tap two times in the unsupported block previously added
  6. Tap on Edit using web editor
  7. The webview doesn't show the web editor, instead it requests the user to log in.

The steps for reproducing it in a public site are the same.

Notes

As far as I investigated the issue comes from the WP.com cookies, when the app tries to authenticate by doing a request to https://wordpress.com/wp-login.php , most of the cookies in the response are empty. Besides the content of the response is HTML code and contains the message: Please enter the verification code generated by your authenticator mobile application..

The user I'm currently using has 2FA enabled so most likely the cause has to do with it but I couldn't find the origin. Once I log in within the web view, I don't see the error anymore.

Besides as far as I checked, this is only happening in development mode.

Tested on iPhone 8 - Simulator, iOS 14, WPiOS 16.6 (DEV)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions