• Getting woocommerce_rest_cannot_view 403 error when using Bearer Token

    When accessing the REST APIs like retrieve Product etc , I am getting 403 woocommerce_rest_cannot_view error. I am passing the token generated by /wp-json/jwt-auth/v1/token endpoint.

    
    {
        "code": "woocommerce_rest_cannot_view",
        "message": "Sorry, you cannot view this resource.",
        "data": {
            "status": 403
        }
    }
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Bagus

    (@contactjavas)

    Hi @shamshudein , i think WooCommerce has their own auth method. In version 1.4.0, this plugin shouldn’t affect WooCommerce.

    What’s the WooCommerce endpoint that you experience this error? That would help debugging ??

    Thanks,
    Bagus

    Thread Starter shamshudein

    (@shamshudein)

    Hi @contactjavas , I am using latest version JWT Auth 1.4.1.

    It is happening to all endpoints when using Bearer Token. Token is generated by passing the login using the user name/pwd of the customer.

    Endpoint used for generating token: /wp-json/jwt-auth/v1/token

    Some examples of WooCommerce EndPoints used with Bearer Token are given below. All of them are giving errors. Same is working when we used Basic Authentication with Admin user.

    /wp-json/wc/v3/customers/<<customerId>>
    /wp-json/wc/v3/products/<<productId>>
    /wp-json/wc/v3/products/categories/<<categoryId>>

    Plugin Author Bagus

    (@contactjavas)

    Hi @shamshudein , yes WooCommerce use Basic not Bearer.
    Is it ok if you just use Basic Auth for consuming WooCommerce API?

    Regards,
    Bagus

    Thread Starter shamshudein

    (@shamshudein)

    @contactjavas I am trying to use JWT Auth to generate token based on Customer user name/pwd dynamically on Mobile App based on customer login.

    Basic Authentication using WooCommerce ConsumerKey & ConsumerSecret from Mobile App will not work as it will expose the Admin Authentication details. That is the reason I am trying to use JWT Auth to generate the token using user credentials (with Customer Role).

    Apparently WooCommerce does not like it. Isn’t it the purpose of JWT Auth Plugin here?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Getting woocommerce_rest_cannot_view 403 error when using Bearer Token’ is closed to new replies.