[wp-trac] [WordPress Trac] #59920: wp.preferences causes continuous Basic Auth prompts

WordPress Trac noreply at wordpress.org
Fri Nov 17 09:56:22 UTC 2023


#59920: wp.preferences causes continuous Basic Auth prompts
---------------------------+-----------------------------
 Reporter:  orestissam     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 With the release of WordPress 6.1, the `@wordpress/preferences` package
 was also introduced to appropriately persist editors' UI preferences in
 user meta. This was backported to core with the [54182] changeset.

 The `wp-preferences` inline script makes a call to the `/wp-
 json/wp/v2/users/me` endpoint, which for unauthenticated users (correctly)
 triggers a HTTP 401 error.

 The problem this causes is that,  for websites that use Basic Auth, the
 401 error will cause the browser's HttpAuthCache entry to be removed. This
 will in turn cause a Basic Auth prompt to be shown again for the next
 request (either the next page load or lazy-loaded images, AJAX calls etc)
 which makes navigating and using the website time-consuming and annoying.

 Since the preferences' persistence logic only applies to editors, a
 possible fix for this would be to prevent enqueuing of the `wp-
 preferences` script for non logged-in users.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59920>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list