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 #1410

Open
emojized opened this issue Apr 24, 2024 · 10 comments
Open

Application Passwords #1410

emojized opened this issue Apr 24, 2024 · 10 comments
Labels
status: need more info Needs more information from the reporter before action can be taken status: on hold Issue paused until further changes addressed

Comments

@emojized
Copy link

Expected behavior

There is a problem with the implementation of the application passwords.

There is an example by https://rudrastyh.com/wordpress/rest-api-create-post.html

but it does not work unless we use the original plugin from here

https://wordpress.org/plugins/application-passwords/

so this is not properly included in the ClassicPress core.

Current behavior

It does not work as expected

Possible solution

Find the parts in the plugin and remerge it.

Steps to reproduce bug

  1. Use the example of Misha Rudrastyh
  2. Use email for login.
  3. Install plugin application-passwords from wordpress
  4. try 1 again.

Context

No response

ClassicPress version

2.0.0

PHP version

I don't know

Can you help?

I can help test a solution

@emojized emojized added status: needs triage This issue needs revision, splitting, or other "gardening" work type: bug Something isn't working labels Apr 24, 2024
@KTS915 KTS915 added type: feature request New feature or request and removed type: bug Something isn't working labels Apr 24, 2024
@KTS915
Copy link
Member

KTS915 commented Apr 24, 2024

It's not a bug; the code bases are just not the same anymore. But it's worth looking at this as a possible feature enhancement.

@emojized
Copy link
Author

it was show stopping my projects... but ok... hmm it was seen in the CP backend but did just not work as on wordpress

@KTS915 KTS915 changed the title 🐞 Application Passwords Application Passwords Apr 25, 2024
@KTS915
Copy link
Member

KTS915 commented Apr 25, 2024

Noting that a new version of the plugin has just been released.

@KTS915 KTS915 removed the status: needs triage This issue needs revision, splitting, or other "gardening" work label Apr 25, 2024
@xxsimoxx
Copy link
Member

I've tested on current develop and creation of a post using REST API and an application password is working for me.

@xxsimoxx
Copy link
Member

xxsimoxx commented May 2, 2024

@emojized can you please test with the plugin I've posted?
You should change those line:

	public $username             = 'pippo';
	public $application_password = '3MDb TDCU DIg2 4oAB oFDK K3aU';
	public $url                  = 'classicpress:8890';

and then use the "Test App Pass" admin page.
test-ap.php.zip

@emojized
Copy link
Author

emojized commented May 4, 2024

thank you very much... but does only work if i have
earlier mentioned application password plugin is present.
running CP Version 2.0.0

@xxsimoxx xxsimoxx added status: needs triage This issue needs revision, splitting, or other "gardening" work and removed type: feature request New feature or request labels May 6, 2024
@xxsimoxx
Copy link
Member

xxsimoxx commented May 6, 2024

I've retested on other hosts, using CP 2.0.0 and the develop branch and works. Either using e-mail or nickname as username.

@emojized can you give more details, like the error that the test plugin shows?

Edit: Please test with Query Monitor to get extra hints.

@emojized
Copy link
Author

emojized commented May 7, 2024

i am on the stable 2.0.0 of course

Response message

string(21) "Internal Server Error"

Response body

object(stdClass)#751 (3) {
["code"]=>
string(18) "incorrect_password"
["message"]=>
string(203) "Error: The password you entered for the username techno is incorrect. Lost your password?"
["data"]=>
NULL
}

@xxsimoxx
Copy link
Member

xxsimoxx commented May 8, 2024

Something strange in the response. This is what I get with a wrong password:

Response message
string(12) "Unauthorized"
Response body
object(stdClass)#1026 (3) {
  ["code"]=>
  string(18) "rest_cannot_create"
  ["message"]=>
  string(56) "Sorry, you are not allowed to create posts as this user."
  ["data"]=>
  object(stdClass)#990 (1) {
    ["status"]=>
    int(401)
  }
}

And Query Monitor gets red about a 401 Unauthorized error.

@mattyrob
Copy link
Collaborator

I used the test code as posted above, amended slightly to allow me to test locally without permalinks or https connection. This test was run on the latest develop code.

I added 2 posts with title as defined by:
'Post using REST API '.$this->username

I passed the user login name in the first and the email address in the second attempt, and both worked for me.

Screenshot 2024-05-29 at 13 50 24

Propose we close this unless OP can provide more details.

@mattyrob mattyrob added status: need more info Needs more information from the reporter before action can be taken status: on hold Issue paused until further changes addressed and removed status: needs triage This issue needs revision, splitting, or other "gardening" work labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: need more info Needs more information from the reporter before action can be taken status: on hold Issue paused until further changes addressed
Projects
None yet
Development

No branches or pull requests

4 participants