I enable WooCommerce rest API and generate consumer_key and consumer_secret. I am developing a WooCommerce shop native mobile application. I do research for the WooCommerce rest API for My Account page login and registration form but can’t see the solution. So if anyone has an idea about My Account page login and registration API then please suggest the solution for this.
Best regard,
Ketan.
2
Answers
==> First install this https://wordpress.org/plugins/json-api-user/ plugin
==> Registration API:
Before the registration call, following API for New nonce generate:
https://site_URL/api/get_nonce/?controller=user&method=register
After that use following API for registration:
https://site_URL/api/user/register/?username=john&[email protected]&user_pass=123456789&nonce=HERE_INSERT_ABOVE_GENERATED_RANDOM_NONCE_STRING&display_name=username
==> Login API:
After that use following API for login:
https://site_URL/wp-json/custom-plugin/login?username=USERNAME_OR_EMAIL-ID&password=PASSWORD
add_action( ‘after_setup_theme’, ‘custom_login’ ); to add_action( ‘after_setup_theme’, ‘login’ );