WooCommerce.NET icon indicating copy to clipboard operation
WooCommerce.NET copied to clipboard

oauth_token missing

Open pawnitsystems opened this issue 5 years ago • 5 comments

I am getting an issue when using your library. I have provided the oauth_token & oauth_token_secret as parameters to the RestAPI Class.

However, I am getting the following exception:

WebException: {"code":"json_oauth1_missing_parameter","message":"Missing OAuth parameter oauth_token","data":{"status":401}}

Your help would be appreciated.

pawnitsystems avatar Sep 06 '20 00:09 pawnitsystems

Can you show your code? Please remove sensitive information.

XiaoFaye avatar Sep 06 '20 20:09 XiaoFaye

code error

pawnitsystems avatar Sep 06 '20 21:09 pawnitsystems

oauth_token is for Wordpress API only, but you are using WooCommerce API, you don't need to assign the oauth_token.

XiaoFaye avatar Sep 06 '20 23:09 XiaoFaye

Nope, I still get the same exception

pawnitsystems avatar Sep 06 '20 23:09 pawnitsystems

Tengo un problema al usar su biblioteca. He proporcionado el oauth_token & oauth_token_secret como parámetros para la clase RestAPI.

Sin embargo, obtengo la siguiente excepción:

WebException: {"code": "json_oauth1_missing_parameter", "message": "Falta el parámetro OAuth oauth_token", "data": {"status": 401}}

Tu ayuda será apreciada.

it may help you,but if so, you should install the NuGet Chilkat.

Cheers.

Chilkat.OAuth1 oauth1 = new Chilkat.OAuth1(); oauth1.ConsumerKey = "ck_216def20b88bf91a881619225d72d6c10af9xxxx"; oauth1.ConsumerSecret = "cs_3a537ca9461897cc9ef8c4625dd718957214xxxx";

        oauth1.SignatureMethod = "HMAC-SHA1";

        oauth1.OauthUrl = "http://blackxxxxxxxx.cl/wc-api/v3/orders";

        bool success = oauth1.AddParam("status", "processing");

        oauth1.OauthMethod = "GET";

        success = oauth1.GenNonce(32);

        Chilkat.Rest rest = new Chilkat.Rest();

        bool bUseQueryParams = true;
        success = rest.SetAuthOAuth1(oauth1, bUseQueryParams);


        bool bTls = false;
        int port = 80;
        bool bAutoReconnect = true;
        success = rest.Connect("http://blackxxxxxx.cl", port, bTls, bAutoReconnect);
        if (success != true)
        {
            MessageBox.Show("Descarga Fallida", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return r;
            
        }

        string responseJson = rest.FullRequestNoBody("GET", "/wc-api/v3/orders");

https://www.example-code.com/csharp/rest_oauth1_params.asp

rodrijeldes avatar Dec 23 '20 13:12 rodrijeldes