Title: Basic_Auth
Last modified: August 22, 2016

---

# Basic_Auth

 *  [burtwalkergmail.com](https://wordpress.org/support/users/burtwalkergmailcom/)
 * (@burtwalkergmailcom)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/basic_auth/)
 * Can’t get Basic_Auth to work. Spent hours trying to figure out why. I’ve tried
   curl, postman, and Paw. Having gone through a ton of searching the cause, I’ve
   tried various things, including running Postman incognito, closing all my browsers,
   etc. Still getting “Sorry, you are not allowed to post on this site.
 * curl -X “POST” “[http://burtwalker.com/wp-json/posts&#8221](http://burtwalker.com/wp-json/posts&#8221);\
   -
   H “Authorization: Basic myencodedauthstring” \ -H “Content-Type: application/
   json” \ -d $'{ “title”: “Hello World!”, “content_raw”: “Content”, “excerpt_raw”:“
   Excerpt” }’
 * Very Frustrated for something that should be simple.
 * [https://wordpress.org/plugins/json-rest-api/](https://wordpress.org/plugins/json-rest-api/)

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

 *  [Someguyagain](https://wordpress.org/support/users/someguyagain/)
 * (@someguyagain)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/basic_auth/#post-5625922)
 * Just got it working but not with this plugin. I’ll post a how to later today.
   Victory!
 *  Thread Starter [burtwalkergmail.com](https://wordpress.org/support/users/burtwalkergmailcom/)
 * (@burtwalkergmailcom)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/basic_auth/#post-5625942)
 * Please do Someguyagain. Can’t wait to see how you solved it.
 *  [Someguyagain](https://wordpress.org/support/users/someguyagain/)
 * (@someguyagain)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/basic_auth/#post-5625974)
 * Okay let’s start with a fresh install of WP. I’m using wp-cli found at [http://wp-cli.org/](http://wp-cli.org/)
 * Download WP
    `wp core download`
 * Setup the config file
    `wp core config --dbname=wp_cli --dbuser=root --dbpass
   =A123456`
 * Install WP
    `wp core install --url=pathToYourWPDir --title=WP-CLI --admin_user
   =admin --admin_password=A123456 admin_email=someEmail@email.com`
 * Now jump into the plugins dir
    `cd somePath/wp-content/plugins`
 * We need to install the api server
    `git clone git@github.com:WP-API/WP-API.git`
 * Now it’s time to install the Basic Auth
    `git clone https://github.com/WP-API/
   Basic-Auth.git`
 * Go ahead and install OAuth1
    `git clone git@github.com:WP-API/OAuth1.git`
 * We have to enable everything by logging into the admin dashboard.
    Under plugins
   activate JSON REST API then JSON Basic Authentication and OAuth Server. Remember
   for the REST API to work you have to have Permalinks setup. I always just use
   Post name.
 * From what I’ve read you have to log out before the Basic Auth will work. Not 
   sure if that is true or not have not tested it yet.
 * So for the fun stuff let’s make a log file and watch it.
    `touch logs.txt && 
   watch -n 1 cat logs.txt`
 * Open up another terminal and use curl to hit the endpoint. *Note you need to 
   be in the same dir that you made the logs.txt
    `curl -s --user admin http://somePathToYourWpSite/
   wp-json/wp/users/me -o "logs.txt"`
 * Type in your password and watch the magic happen.
 * Good luck 🙂
 *  [Someguyagain](https://wordpress.org/support/users/someguyagain/)
 * (@someguyagain)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/basic_auth/#post-5625975)
 * ****Sorry “admin_email=someEmail@email.com” when installing WP should be “–admin_email
   =someEmail@email.com”
 *  [robert.glez](https://wordpress.org/support/users/robertglez/)
 * (@robertglez)
 * [11 years ago](https://wordpress.org/support/topic/basic_auth/#post-5626170)
 * [@someguyagain](https://wordpress.org/support/users/someguyagain/) thanks for
   your guide! Just a clarification for future readers:
 * > Just got it working but not with this plugin. I’ll post a how to later today.
   > Victory!
 * It IS this plugin 🙂 But besides this plugin you also need the extra Basic Authentication
   WP-API plugin:
    [https://github.com/WP-API/Basic-Auth](https://github.com/WP-API/Basic-Auth)
 * It’s just a php file and as any other plugin you can drop it in your /wp-content/
   plugins folder and activate through admin panel.
 * So in summary, once you install and activate both plugins:
    [https://wordpress.org/plugins/json-rest-api/](https://wordpress.org/plugins/json-rest-api/)
   and [https://github.com/WP-API/Basic-Auth](https://github.com/WP-API/Basic-Auth)
   Basic Authentication will work out of the box (or at least that has been my experience
   🙂 )
 *  [diggersworld](https://wordpress.org/support/users/diggersworld/)
 * (@diggersworld)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/basic_auth/#post-5626179)
 * I was having the same issue with basic authentication too and my issue was of
   two parts.
 * The first was that I didn’t have Basic-Auth installed (thanks robert.giaz for
   that).
 * The second was that I’m working with a multi-site install. It appears that when
   you make a request to the site the user you’re authenticating needs to exist 
   for that specific site. If they exist just at a network level or in a sibling
   site the authentication will fail.
 *  [robert.glez](https://wordpress.org/support/users/robertglez/)
 * (@robertglez)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/basic_auth/#post-5626180)
 * [@diggersworld](https://wordpress.org/support/users/diggersworld/) glad it helped.
   It’s always good to know one’s posts might save some time to others.

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

The topic ‘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

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

 * 7 replies
 * 4 participants
 * Last reply from: [robert.glez](https://wordpress.org/support/users/robertglez/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/basic_auth/#post-5626180)
 * Status: not resolved