Skip to content

Conversation

@itsmeichigo
Copy link
Contributor

@itsmeichigo itsmeichigo commented Nov 5, 2025

Closes WOOMOB-1432

Description

This PR updates the behavior of web views on the app to auto-authenticate users whenever possible. Changes include:

  • Updated shouldAuthenticateAdminPage to check for SSO module rather than for WPCom sites. This follows the changes made in Improve authentication logic for authenticated web view #15164.
  • Updated the workaround to force HTTPS for site URLs. The solution in Force https for jetpack sites #16279 doesn't fix the problems with login URL and admin URL, so authenticated web view doesn't work properly for sites with HTTP scheme.
  • Created a new reusable SwiftUI view AuthenticatableWebView that checks for admin URL and authenticates user automatically if the above conditions are met.
  • Updated web views in various flows to support authenticating the admin page when possible: custom field URLs, IPP plugin setup, and adding tax rates in order creation.
  • Additionally: I squeezed in an unrelated change to fix the delay in site name update on the My Store and Menu screens upon app start.

Test Steps

Before testing each case, it's best to delete the app to avoid existing cookies causing false positive test results. For each test, use a site that supports Jetpack SSO (either atomic site, or self-hosted site with Jetpack SSO enabled from the settings), or log in to a self-hosted store with site credentials.

TC1: shouldAuthenticateAdminPage

  1. Navigate to Menu tab > WooCommerce Admin.
  2. Confirm that the admin page is authenticated automatically.
  3. Switch to a CIAB site and repeat the steps, confirm that the admin page is authenticated automatically too.
Simulator.Screen.Recording.-.iPhone.17.-.2025-11-06.at.16.01.04.mov

TC2: Site with HTTP scheme

Repeat the steps in TC1.

TC3: custom field URLs

  1. Open a product.
  2. Tap on "Add more details" then select "Custom Fields".
  3. Add a new custom field that contains a URL (use the admin URL of your site for the test).
  4. Save the changes.
  5. In the fields list, tap on the URL.
  6. Confirm that the URL
Simulator.Screen.Recording.-.iPhone.17.-.2025-11-06.at.16.02.02.mov

TC4: IPP plugin setup

  1. Ensure that your test site doesn't have WooPayments setup done yet.
  2. Open the Payments hub in the app.
  3. Start the setup from the app.
  4. Confirm it uses the Authenticated WebView, and the onboarding screen is opened without issues.
Simulator.Screen.Recording.-.iPhone.17.-.2025-11-06.at.16.06.00.mov

TC5: adding tax rates

  1. Start order creation.
  2. Tap on "Set tax rate"
  3. Tap on "Edit tax rates in admin"
  4. Confirm that the admin page is authenticated automatically.
Simulator.Screen.Recording.-.iPhone.17.-.2025-11-06.at.16.08.18.mov

TC6: store name on app start up.

  1. Ensure that you're logged in to a store.
  2. Relaunch the app.
  3. Confirm that store name is displayed immediately on the My Store and Menu tabs.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@itsmeichigo itsmeichigo added this to the 23.7 milestone Nov 5, 2025
@itsmeichigo itsmeichigo added the type: task An internally driven task. label Nov 5, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 5, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16318-58a0ac8
Version23.6
Bundle IDcom.automattic.alpha.woocommerce
Commit58a0ac8
Installation URL3aa8a3auk4guo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@itsmeichigo itsmeichigo changed the title CIAB: Auto authenticate users in web views Auto authenticate users in web views Nov 6, 2025
@itsmeichigo itsmeichigo marked this pull request as ready for review November 6, 2025 12:16
@itsmeichigo itsmeichigo requested a review from adborbas November 6, 2025 12:16
Copy link
Contributor

@RafaelKayumov RafaelKayumov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works as described. Pre-approving. Left 1 comment.
Also noticed 1 second delay between displaying store name upon app launch.

Simulator.Screen.Recording.-.iPhone.17.Pro.Max.-.2025-11-06.at.19.55.29.mov

<CommandLineArgument
argument = "-simulate-stripe-card-reader"
isEnabled = "NO">
isEnabled = "YES">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I accidentally committed that after testing. Reverted in 58a0ac8.

@itsmeichigo
Copy link
Contributor Author

Thanks for the review Rafael.

Also noticed 1 second delay between displaying store name upon app launch.

I hope this is still better than the longer delay earlier? I'll enable auto-merge for now, but please let me know if something else can be done here.

@itsmeichigo itsmeichigo enabled auto-merge November 7, 2025 02:36
@itsmeichigo itsmeichigo merged commit b66223a into trunk Nov 7, 2025
14 checks passed
@itsmeichigo itsmeichigo deleted the woomob-1432-ios-auto-authenticate branch November 7, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants