I created a new user (called external) in a WordPress site with manage users capabilites. I installed Application Passwords plugin to generate a token for that user.
Now is it possibile to create a simple HTML form on a NON WordPress website to send POST request to /wp/v2/users
with external user credentials to create new users? Alternatively is it possibile to use "vanilla" PHP only or do I have to use JavaScript/jQuery with Ajax?
EDIT: reading around I understood I have to use cURL to do a POST request with PHP (in WordPress I' have used wp_remote_post(...)
) but I never used cURL, how can "convert" a wp_remote_post
call to a cURL POST request? How can I manage authentication?
I created a new user (called external) in a WordPress site with manage users capabilites. I installed Application Passwords plugin to generate a token for that user.
Now is it possibile to create a simple HTML form on a NON WordPress website to send POST request to /wp/v2/users
with external user credentials to create new users? Alternatively is it possibile to use "vanilla" PHP only or do I have to use JavaScript/jQuery with Ajax?
EDIT: reading around I understood I have to use cURL to do a POST request with PHP (in WordPress I' have used wp_remote_post(...)
) but I never used cURL, how can "convert" a wp_remote_post
call to a cURL POST request? How can I manage authentication?
- 1 would the browser be contacting the endpoint, or the non-WordPress server? Note that there are major security consequences that depend upon your answer to that question, if it's the browser that talks to the WP site, it'll need the application password to do so, which is a major security breach – Tom J Nowell ♦ Commented Sep 17, 2020 at 18:18
1 Answer
Reset to default 1If i'm not sure if i have misunderstand your question might, yes you need to send a post request to POST /wp/v2/users api. That should do the trick i dont think programming language have issue on this. I believe you should decide how post submitting flow should be affecting.