Title: woocommerce_rest_authentication_error
Last modified: September 1, 2016

---

# woocommerce_rest_authentication_error

 *  [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/)
 * Olá,
 * Estou começando a usar REST API e quero retornar uma lista de pedidos do woocommerce
   através de JSON, mas está retornando a mensagem:
 * {
    “code”: “woocommerce_rest_authentication_error”, “message”: “Invalid Signature–
   provided signature does not match.”, “data”: { “status”: 401 } }
 * Estou usando a seguinte requisição http
 * [http://hospedamidia.com.br/redmaxloja/wp-json/wc/v1/orders?oauth_consumer_key=minha_consumer_key&oauth_timestamp=1469820869&oauth_nonce=HtGdhW&oauth_signature=pvyfVEkSuXASoXC8jaoYjud8sDg%3D&oauth_signature_method=HMAC-SHA1](http://hospedamidia.com.br/redmaxloja/wp-json/wc/v1/orders?oauth_consumer_key=minha_consumer_key&oauth_timestamp=1469820869&oauth_nonce=HtGdhW&oauth_signature=pvyfVEkSuXASoXC8jaoYjud8sDg%3D&oauth_signature_method=HMAC-SHA1)
 * Alguém pode me ajudar? O que estou fazendo de errado?
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Contributor [Claudio Sanches](https://wordpress.org/support/users/claudiosanches/)
 * (@claudiosanches)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616533)
 * The signature is invalid, read the docs in order to generate a correct signature:
   [http://woothemes.github.io/woocommerce-rest-api-docs/#index](http://woothemes.github.io/woocommerce-rest-api-docs/#index)
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616581)
 * Eu dei uma boa lida na documentação e encontrei mais dúvidas do que respostas.
 * Estou procurando cursos e videos para aprender sobre API REST no Woocommerce,
   mas ainda não tem muito material na internet.
 * Estou com mais dificuldade na parte de autenticação por Oauth. Percebi que não
   basta somente criar as chaves do usuário e tentar acessar por requisição http
   como mostrei acima.
 * Espero que vocês consigam me ajudar por aqui como tenho solicitado.
 *  [Caleb Burks](https://wordpress.org/support/users/icaleb/)
 * (@icaleb)
 * Automattic Happiness Engineer
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616610)
 * How the API works is pretty self-explanatory – it sounds like you are just having
   trouble with the oauth. If you site has an SSL certificate it is a lot easier
   to connect to than using OAuth 1.0a for http.
 * Maybe try one of the official libraries for the authentication? [https://woothemes.github.io/woocommerce-rest-api-docs/#libraries-and-tools](https://woothemes.github.io/woocommerce-rest-api-docs/#libraries-and-tools)
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616620)
 * Boa tarde, sou novo no WordPress e gostaria de saber como adicionar bibliotecas
   no Woocommerce.
 * É só colocar a arquivo da biblioteca em alguma pasta? Qual pasta?
 * Obrigado.
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616621)
 * Estou usando o postman para fazer as requisições http.
 * Tem algum exemplo que eu posso usar para trazer os dados de pedidos através do
   Postman ou não é possível?
 *  [Caleb Burks](https://wordpress.org/support/users/icaleb/)
 * (@icaleb)
 * Automattic Happiness Engineer
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616625)
 * What exactly are you trying to do with the API? You don’t need to bring those
   libraries into WooCommerce.
 * They work independently in your own app that is querying the api.
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616627)
 * Eu quero listar todos os pedidos do site. Mas estou tentando trazer os dados 
   através usando cURL para testes. Como estou testando, ainda não criei nenhum 
   dos arquivos de biblioteca.
 * É possível fazer testes usando apenas cURL?
 * exemplo:
 * curl [http://hospedamidia.com.br/redmaxloja/wp-json/wc/v1/orders?oauth_consumer_key=minha_consumer_key&oauth_timestamp=1469820869&oauth_nonce=HtGdhW&oauth_signature=pvyfVEkSuXASoXC8jaoYjud8sDg%3D&oauth_signature_method=HMAC-SHA1](http://hospedamidia.com.br/redmaxloja/wp-json/wc/v1/orders?oauth_consumer_key=minha_consumer_key&oauth_timestamp=1469820869&oauth_nonce=HtGdhW&oauth_signature=pvyfVEkSuXASoXC8jaoYjud8sDg%3D&oauth_signature_method=HMAC-SHA1)
 * Se eu não conseguir trazer os dados apenas através do curl e precisar usar a 
   biblioteca, em que pasta do meu site eu devo colocar os arquivos?
 *  [Caleb Burks](https://wordpress.org/support/users/icaleb/)
 * (@icaleb)
 * Automattic Happiness Engineer
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616630)
 * Yes, that is how the web api works. You don’t put a library in your site folders–
   the authentication libraries are used within your own external application.
 * I don’t mean to sound rude, but it seems like you aren’t in full understanding
   of how to use a Rest API. Also, what you are using it for doesn’t make much sense.
 * You should get in contact with a developer that can help you with your development
   needs. We can’t help you build a custom application here.
 * – [http://jobs.wordpress.net/](http://jobs.wordpress.net/)
    – [https://codeable.io/](https://codeable.io/)
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616633)
 * Entendi. Vou estar trabalhando para criar uma aplicação externa e usar as bibliotecas
   como você mencionou.
 * Obrigado.
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616640)
 * Bom dia, eu consegui trazer os dados com sucesso!
 * Agora quero trazer os dados no formato Json. Vi em alguns fóruns que devo usar
   json_encode(), mas não sei bem onde devo colocar no meu código.
 * Podem me ajudar?
 * Minha classe:
 * <?php
    require_once ‘class-wc-api-client.php’;
 * $consumer_key = ‘ck_123’; // Adicionar Consumer Key aqui
    $consumer_secret = ‘
   cs_123’; // Adicionar Consumer Secret aqui $store_url = ‘[http://www.lojaredmax.com.br/&#8217](http://www.lojaredmax.com.br/&#8217);;//
   Adicionar endereço do site
 * $options = array(
    ‘debug’ => true, ‘return_as_array’ => false, ‘validate_url’
   => false, ‘timeout’ => 30, ‘ssl_verify’ => false, );
 * // Inicializando a classe
    $wc_api = new WC_API_Client( $consumer_key, $consumer_secret,
   $store_url );
 * // Trazer Pedido por ID
    $test = ( $wc_api->get_order ( 2016 ) );
 * print_r($test);
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616641)
 *  Thread Starter [Excelent Mídia](https://wordpress.org/support/users/glebersoninacio/)
 * (@glebersoninacio)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616642)
 * Achei a solução. Para quem precisar futuramente, ai está:
 * $test = json_encode( $wc_api->get_order ( 2016 ) );
 * print_r($test);
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616643)
 * >  Now I want to bring the data in JSON format. I saw in some forums that I use
   > json_encode (), but I do not know where should I put in my code .
   > Can you help me?
 * The REST API returns JSON by default.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘woocommerce_rest_authentication_error’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 13 replies
 * 4 participants
 * Last reply from: [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/woocommerce_rest_authentication_error/#post-7616643)
 * Status: not resolved