Mohammad_Asef
Mohammad_Asef

Reputation: 336

How to get token from woocommerce rest api

I want to get token from wooCommerce rest api in mobile app, I am using jwt_auth plugin for login customer it create token for me but when I want to use Password_reset plugin for forgot password jwt does not allow because it want token. so How can I get token without login.

Upvotes: 0

Views: 1318

Answers (2)

user14942624
user14942624

Reputation:

You need make custom route without any token for your change password and forget password

for make forget password and change password you need

  1. check email or username exits
  2. if exits send a verify code to email for confirmation
  3. after check the code is valid make new custom rest api for change password

Upvotes: 1

Manik Malhotra
Manik Malhotra

Reputation: 632

If you want to generate token without user login then it will decrease security of your app.

I would suggest you to create some custom endpoints for password reset and whitelist them from jwt like this -

add_filter( 'jwt_auth_whitelist', function ( $endpoints ) {
    return array(
        '/wp-json/custom/v1/webhook/*',
        '/wp-json/custom/v1/otp/*',
        '/wp-json/custom/v1/account/check',
        '/wp-json/custom/v1/register',
    );
} );

Upvotes: 3

Related Questions