Title: External request to WP-API &#8211; Basic Auth
Last modified: August 30, 2016

---

# External request to WP-API – Basic Auth

 *  Resolved [amarie](https://wordpress.org/support/users/tuesdave/)
 * (@tuesdave)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/external-request-to-wp-api-basic-auth/)
 * I’m trying to hit my WordPress API using Basic Auth with Guzzle (http tool) from
   my middleware (Laravel).
 *     ```
       $username = 'myAdminUserName';
       $password = 'myAdminPassword';
       $uri = 'https://example.com/wp-json/mysite-api/cleared-action';
       $response = $this->guzzle->put(
           $uri,
           [
               'headers' => [
                   'Authorization' => 'Basic ' . base64_encode( $username . ':' . $password )
               ],
               'body' => [
                   'user_id' => $wordpressId  //passed into this function
               ]
           ]
       );
       ```
   
 * It then hits the route set up in my WordPress API.
 *     ```
       $routes['/mysite-api/cleared-action'] = array(
               array(array($this, 'automatedClearing'), WP_JSON_Server::ACCEPT_JSON
                                                      | WP_JSON_Server::CREATABLE
                                                      | WP_JSON_Server::EDITABLE)
           );
       ```
   
 * However that is as far as it gets. It does not hit my automatedClearing endpoint.
 * I keep getting a 200 response from my call, so it definitely hits the route, 
   but does not execute the endpoint. The response is basically just an empty one.
 * My WordPress access.log shows the route being hit, but my error.log doesn’t show
   anything. By the way, this is a laravel Homestead (vagrant) box hitting a WordPress
   vagrant box.
 * I’m wondering if this is because the WP-API requires a nonce? But I thought nonce
   was only needed within WordPress, whereas this is an external app hitting WordPress.
 * Any guidance appreciated
 * [https://wordpress.org/plugins/json-rest-api/](https://wordpress.org/plugins/json-rest-api/)

The topic ‘External request to WP-API – Basic Auth’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-rest-api_2e3641.svg)
 * [WP REST API (WP API)](https://wordpress.org/plugins/json-rest-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-rest-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-rest-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-rest-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-rest-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-rest-api/reviews/)

## Tags

 * [nonce](https://wordpress.org/support/topic-tag/nonce/)

 * 0 replies
 * 1 participant
 * Last reply from: [amarie](https://wordpress.org/support/users/tuesdave/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/external-request-to-wp-api-basic-auth/)
 * Status: resolved