• Resolved stinkyweezle

    (@stinkyweezle)


    Since updating to 3.0.3 (from 2.x) I can no longer add to cart via a react component (using the @cocart/cocart-rest-api library). I’m suddenly getting a 401 error from the server.

    Response is:

    
    {"code":"woocommerce_rest_authentication_missing_parameter","message":"Missing OAuth parameter oauth_consumer_key","data":{"status":401}}
    

    Any ideas? I thought at first it was due to be operating on a local dev server (not https), but the same issue occurs over https as well.

    Request (cURL) is along the lines of:

    curl 'https://mysite.foo/wp-json/cocart/v2/add-item?oauth_consumer_key=&oauth_nonce=H8zvy7kyYv6Czv395G4ck87ASnwHRnc0&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1621259305&oauth_version=1.0&oauth_signature=Id5SYwKgg8FWXwREMoqsse7ev5N5mZjRbIvzKGqjrJ0%3D' \
      -H 'Connection: keep-alive' \
      -H 'Pragma: no-cache' \
      -H 'Cache-Control: no-cache' \
      -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"' \
      -H 'Accept: application/json' \
      -H 'DNT: 1' \
      -H 'sec-ch-ua-mobile: ?0' \
      -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36' \
      -H 'Content-Type: application/json;charset=UTF-8' \
      -H 'Origin: https://mysite.foo' \
      -H 'Sec-Fetch-Site: same-origin' \
      -H 'Sec-Fetch-Mode: cors' \
      -H 'Sec-Fetch-Dest: empty' \
      -H 'Referer: https://mysite.foo/product/teamwear/socks-teamwear/full-length-socks/' \
      -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
      -H 'Cookie: _ga=GA1.3.968707277.1591347534; cookielawinfo-checkbox-non-necessary=yes; cookielawinfo-checkbox-necessary=yes; viewed_cookie_policy=yes; CookieLawInfoConsent=eyJuZWNlc3NhcnkiOnRydWUsIm5vbi1uZWNlc3NhcnkiOnRydWV9; wp-settings-1=libraryContent%3Dbrowse; _fbp=fb.2.1610448280180.1841253780; wp-settings-time-1=1620288912; _gcl_au=1.1.1712335327.1620838761; woocommerce_items_in_cart=1; woocommerce_cart_hash=7cb4c4f4bc7decf39ec9d45b450c50c0; wp_cocart_session_e166e212aa264c65fd64411d789d41b0=1%7C%7C1621861183%7C%7C1621774783%7C%7Ced37fc15784116f6f331d3a1fba9be8a; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_e166e212aa264c65fd64411d789d41b0=britweb-mdhtw%7C1621429306%7CIpEHRXRpWT3AWskl7GezkwfbjOBlgjzn1NmDY7i3Z9g%7Cacc2705fd4154f40165ae969ccc2be075bb688bef5f604bd536650863c96c0e9; tk_ai=woo%3ARTLZgaY3TlPi%2Fog01f1y%2FxrV' \
      --data-raw '{"key":"cartkosnw871","product_id":"100593","quantity":"1","variation_id":100608,"variation":{"size":"X-Small"},"cart_item_data":{"order_part_key":"kosnxi6f","addons":[],"playerData":[{"size":"X-Small","values":{}}],"variant_price":13,"variant_size":"X-Small"}}' \
      --compressed
    • This topic was modified 3 years, 6 months ago by stinkyweezle.
    • This topic was modified 3 years, 6 months ago by stinkyweezle.
    • This topic was modified 3 years, 6 months ago by stinkyweezle.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sébastien Dumont

    (@sebd86)

    This support forum is for the plugin only! If you have bug issues with the JS library please report them on the GitHub repository were I can manage it better.

    Thank you.

    Thread Starter stinkyweezle

    (@stinkyweezle)

    No worries posted it there too.. not actually sure which side is failing here..

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘401 Error when adding to cart’ is closed to new replies.