prionkor / yith-woocommerce-wishlist-rest-api

REST API for YITH Woocommerce Wishlist WordPress plugin.
7 stars 5 forks source link

authentication issue #3

Open harishksoft opened 3 years ago

harishksoft commented 3 years ago

when try to authenticate using user credential, its not working and the /wishlists endpoint return error response

prionkor commented 3 years ago

Could you copy the error response? How are you authenticating?

prionkor commented 3 years ago

I see you commented on the other issue. Could you turn of WP_DEBUG and so we know what the actual error is?

harishksoft commented 3 years ago

Could you copy the error response? How are you authenticating? @prionkor i'm testing the API using POSTMAN client and using basic authentication like username and password. i also tried woocommerce consumer key and secret, but not working. { "code": "unauthorized", "message": "Authentication Required", "data": { "code": 401, "message": "Authentication Required", "data": [] } } everytime i'm getting this error.

i have checked the code and saw that public static function check_auth( $request ){

        if( is_user_logged_in() ) {
            return true;
        }

        return new \WP_Error('unauthorized', 'Authentication Required', [
            'code' => 401,
        'message' => 'Authentication Required',
            'data' => [],
        ]);
    }

using this function to authenticate user, but don't know this will work when called from REST

harishksoft commented 3 years ago

the endpoints /wishlist/v1 its getting responses with supporting endpoints.but actual required apis are not working

rszwt commented 1 year ago

Hello @prionkor I have face same issue as mention in above response of @harishksoft .

as used is_user_logged_in() in check_auth($request) function how can API check in case of POSTMAN or real-time route?

Anyone guy's ..............................