woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
313 stars 113 forks source link

When attempting a new connection with Basic HTTP Auth, it returns "Not a WordPress site" error #3883

Open iamgabrielma opened 3 years ago

iamgabrielma commented 3 years ago

Describe the bug When attempting to connect a new store in the WooCommerce app via "store address" without having Jetpack installed/connected, the error message changes depending if the user use iOS or Android:

While in Android it says there's no Jetpack installed so the user knows what's the next step, in iOS the error message is "not a WordPress site" instead, which may confuse the user unnecessarily.

To Reproduce Steps to reproduce the behavior:

  1. Go to the WooCommerce app
  2. Click on "Enter your Store Address"
  3. Add an URL where Jetpack is not installed or connected.

Screenshots

Expected behavior

A different error message where is explained that Jetpack is not installed or setup instead.

Isolating the problem (mark completed items with an [x]):

Mobile Environment Please include:

WordPress Environment

``` ` ### WordPress Environment ### WordPress address (URL): http://brainy-fireman.flywheelsites.com Site address (URL): http://brainy-fireman.flywheelsites.com WC Version: 5.1.0 REST API Version: ✔ 5.1.0 WC Blocks Version: ✔ 4.4.3 Action Scheduler Version: ✔ 3.1.6 WC Admin Version: ✔ 2.0.2 Log Directory Writable: ✔ WP Version: 5.7 WP Multisite: – WP Memory Limit: 128 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: – ### Server Environment ### Server Info: Flywheel/5.1.0 PHP Version: 7.4.16 PHP Post Max Size: 300 MB PHP Time Limit: 178 PHP Max Input Vars: 1000 cURL Version: 7.68.0 OpenSSL/1.1.1f SUHOSIN Installed: – MySQL Version: 5.7.32-google Max Upload Size: 300 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 5.1.0 WC Database Prefix: wp_vxh26jmees_ Total Database Size: 3.72MB Database Data Size: 2.34MB Database Index Size: 1.38MB wp_vxh26jmees_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_vxh26jmees_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_vxh26jmees_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_vxh26jmees_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_vxh26jmees_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_vxh26jmees_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_vxh26jmees_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_options: Data: 1.50MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_posts: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_vxh26jmees_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_vxh26jmees_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_vxh26jmees_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_vxh26jmees_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_vxh26jmees_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_vxh26jmees_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_vxh26jmees_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_vxh26jmees_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_vxh26jmees_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_vxh26jmees_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB ### Post Type Counts ### attachment: 1 page: 6 post: 2 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (1) ### WooCommerce: by Automattic – 5.1.0 ### Inactive Plugins (0) ### ### Dropin Plugins (1) ### db-error.php: db-error.php ### Settings ### API Enabled: – Force SSL: – Currency: GBP (£) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – ### WC Pages ### Shop base: #6 - /?page_id=6 Cart: #7 - /?page_id=7 Checkout: #8 - /?page_id=8 My account: #9 - /?page_id=9 Terms and conditions: ❌ Page not set ### Theme ### Name: Twenty Twenty-One Version: 1.0 (update to version 1.2 is available) Author URL: https://wordpress.org/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ ### Templates ### Overrides: – ### Action Scheduler ### Pending: 1 Oldest: 2021-03-29 06:53:52 +0000 Newest: 2021-03-29 06:53:52 +0000 ### Status report information ### Generated at: 2021-03-29 06:53:13 +00:00 ` ```
shiki commented 3 years ago

The expectation is that the app should display this screen instead:

designsimply commented 3 years ago

I tested this today using a site hosted at jurassic.ninja and I was not able to replicate the problem using the same versions of WordPress and WooCommerce on that web host. Strange! 😕 I reported similar-is issue at https://github.com/woocommerce/woocommerce-ios/issues/3392 as part of WCiOS 5.7 beta testing, however, I had been testing with a very old setup that had outdated versions of WordPress and Jetpack installed but no WooCommerce plugin. At the time, I thought the problem may have been because of my outdated versions of things—but I need to check that assumption because I see you are using WP 5.7! 🤔 Still, in a new test using WordPress 5.7 and WooCommerce 5.1.0 I see the correct Jetpack install prompt.

IMG_4833

Jetpack prompt during login on WCiOS 6.3.0.1 TestFlight beta with iPhone 11 iOS 14.4 on frequent-hamerkop.jurassic.ninja (WP 5.7 WC 5.1.0) after attempting the Enter Your Store Address login flow.

Mobile Environment

WordPress Environment

``` ### WordPress Environment ### WordPress address (URL): https://frequent-hamerkop.jurassic.ninja Site address (URL): https://frequent-hamerkop.jurassic.ninja WC Version: 5.1.0 REST API Version: ✔ 5.1.0 WC Blocks Version: ✔ 4.4.3 Action Scheduler Version: ✔ 3.1.6 WC Admin Version: ✔ 2.0.2 Log Directory Writable: ✔ WP Version: 5.7 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: – ### Server Environment ### Server Info: Apache/2.4.46 (Unix) OpenSSL/1.0.2g PHP Version: 7.4.16 PHP Post Max Size: 1 GB PHP Time Limit: 30 PHP Max Input Vars: 5000 cURL Version: 7.47.0 OpenSSL/1.0.2g SUHOSIN Installed: – MySQL Version: 5.7.33-0ubuntu0.16.04.1-log Max Upload Size: 512 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 5.1.0 WC Database Prefix: wp_ Total Database Size: 3.73MB Database Data Size: 2.35MB Database Index Size: 1.38MB wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 1.48MB + Index: 0.03MB + Engine InnoDB wp_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_posts: Data: 0.05MB + Index: 0.06MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB ### Post Type Counts ### attachment: 1 page: 6 post: 7 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ❌Error messages should not be shown to visitors. ### Active Plugins (2) ### Companion Plugin: by Osk – 1.18 – https://github.com/Automattic/companion WooCommerce: by Automattic – 5.1.0 ### Inactive Plugins (0) ### ### Settings ### API Enabled: – Force SSL: – Currency: GBP (£) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – ### WC Pages ### Shop base: #14 - /shop/ Cart: #15 - /cart/ Checkout: #16 - /checkout/ My account: #17 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Twenty Twenty-One Version: 1.2 Author URL: https://wordpress.org/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ ### Templates ### Overrides: – ### Action Scheduler ### Pending: 1 Oldest: 2021-03-29 22:48:47 +0000 Newest: 2021-03-29 22:48:47 +0000 ### Status report information ### Generated at: 2021-03-29 22:48:16 +00:00 ```
shiki commented 3 years ago

After some tests, I can reproduce this with a site that is protected with a basic auth (example). The site URL mentioned in this issue, http://brainy-fireman.flywheelsites.com, is protected with a password.

I performed similar steps with my site:

  1. I have a WooCommerce site, https://purplefish.shiki.me, which is connected to Jetpack.
  2. I added a basic auth to the Nginx config.
  3. Logged in on both iOS and Android. For both platforms, I receive the error “The website is not a WordPress site”.

I can also reproduce the same behavior using the http://brainy-fireman.flywheelsites.com site. Here is Android:


@iamgabrielma Would you able to remove the password from your site and see if this fixes the problem?

iamgabrielma commented 3 years ago

The site URL mentioned in this issue, http://brainy-fireman.flywheelsites.com, is protected with a password.

Apologies, I didn't realize I had to setup billing in Flywheel to make the site non-password protected.

By setting this up and removing the password protection I no longer see the "not a WordPress.com site" error when attempting to connect via the iOS app. I couldn't replicate it either with a fresh jurassic.ninja site, so the auth step seems to be what throws this error.

I have seen this same problem on other sites that were not password protected, however I don't have any by hand now. Is there anything that we could check/ask if this happens again? For example would it help if we ask users for their .htaccess / nginx config files to double check that is not caused by some redirection?

designsimply commented 3 years ago

I feel like the first best solution would be to able to detect basic auth and provide a helpful, specific error message—@shiki do you agree?

shiki commented 3 years ago

@designsimply I created a separate issue for it: https://github.com/woocommerce/woocommerce-ios/issues/3891. Let me know if it can be improved!

I'm not sure of the priority of that though. I don't know how often we receive instances where the problem is a password-protected site. Maybe you have an idea?

shiki commented 3 years ago

@iamgabrielma

Is there anything that we could check/ask if this happens again? For example would it help if we ask users for their .htaccess / nginx config files to double check that is not caused by some redirection?

I think checking the site is manually password-protected is good enough. The redirection can also be detected by opening the site in the browser. You'd usually be able to detect the redirect that way. Or checking the headers via curl.

shiki commented 3 years ago

Additional investigation by @anitaa1990 in p1617069822244600/1616987145.235600-slack-C6H8C3G23.

So I was able to reproduce the issue Gabriel mentioned by creating a jurassic site with Woo but no Jetpack. The error displayed on Android is that we need Jetpack and the error displayed on iOS is that it is not a WordPress site :thinking_face: :point_down: is android

iOS:

https://user-images.githubusercontent.com/198826/113029210-6189e800-9149-11eb-9cb4-c589a867c43d.MP4

iamgabrielma commented 3 years ago

3936018-zen

PHP: 7.2.34
WordPress: 5.6
Jetpack: 9.3 ( out of date )
iamgabrielma commented 1 year ago

Something interesting I learned today is that iOS might treat this differently than Android when dealing with HTTP vs HTTPS, from p1697601003627639/1697599124.690389-slack-C6H8C3G23

Our configuration doesn't allow us to query network requests with HTTP. I'm confused though why the request for site info passed with HTTP.But I believe you can tell the customer that they need to set up HTTPS for their site for security reasons, and our app requires that to work.