wp-net / WordPressPCL

This is a portable library for consuimg the WordPress REST-API in (almost) any C# application
MIT License
340 stars 130 forks source link

Can I Generate Application Password with Wordpress admin acccount? #313

Closed oguzdelioglu closed 6 months ago

oguzdelioglu commented 2 years ago

Can I create application password with wordpress username and password?

I haven't seen any code about it. I guess that's not possible.

My client has 1000s of websites and I need to get an application password for these websites. I can change site settings with these application passwords.

But I don't want to do this manually. Is there a code snippet to generate the application password?

ThomasPe commented 2 years ago

Since an application password is tied to the user this can be done through the authenticated User client, like this:

await _clientAuth.Users.CreateApplicationPasswordAsync("my-key-name");

hbcondo commented 7 months ago

CreateApplicationPassword method is working for me so I think this issue should be closed but documented in the Users markdown help file.