Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application Passwords triggers 401 on REST API requests when using Basic Auth #224

Open
2 tasks
rmccue opened this issue Dec 9, 2022 · 2 comments
Open
2 tasks
Labels
bug Existing functionality isn't behaving as expected must have Must be done, high priority

Comments

@rmccue
Copy link
Member

rmccue commented Dec 9, 2022

Steps to reproduce:

  1. Enable and configure the Basic Auth functionality for an environment
  2. Create an Application Password (this triggers WP_Application_Passwords::is_in_use() to return true by setting the using_application_passwords network setting)
  3. Send a REST API request to the environment with your Basic Auth setting set

Publicly-accessible API endpoints should be accessible; instead, they return a 401.

This is increased priority, as if sending REST API requests from the browser, the 401 returned by Application Passwords causes the browser's internal auth cache to be reset, which requires users to log in again repeatedly.

Basic Auth should take priority here as it's site-wide, but this will mean that Application Passwords can't actually be used in combination. I think that's an acceptable compromise, as regular Require Login can be used in those cases instead, but we should ensure it's documented.

Acceptance criteria:

  • Sending a request with Basic Auth headers to a public REST API endpoint (e.g. /wp-json/) should return a 200 response
  • Documentation should indicate Basic Auth is not compatible with Application Passwords
@rmccue rmccue added bug Existing functionality isn't behaving as expected must have Must be done, high priority labels Dec 9, 2022
@roborourke
Copy link
Contributor

When you say "return a 200 error" do you mean a 200 response code, with JSON output indicating an error?

@rmccue
Copy link
Member Author

rmccue commented Dec 15, 2022

When you say "return a 200 error" do you mean a 200 response code, with JSON output indicating an error?

Whoops! I actually just meant that it should be successful; updated to "return a 200 response"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing functionality isn't behaving as expected must have Must be done, high priority
Projects
None yet
Development

No branches or pull requests

2 participants