title: 401 when trying to create a post in Wordpress API using Oauth 1.0
body: <p>I'm trying to create a Wordpress post through Wordpress API v2, however the oauth 1.0 is throwing 401 at me when I do axios.post. When I do axios.get, everything's perfect and I get the result.</p>
  
  <p>I can create or delete posts through Postman without a problem, but it configures itself automatically. It would be nice if I could copy the request somehow from postman and put it into axios code, but couldn't find this option.</p>
  
  <p>I tried specifying the header for content-type as application/json like so:</p>
  
  <pre><code>headers: {
      'Content-Type': 'application/json'
  }
  </code></pre>
  
  <p>as it was in Postman, but still no change.</p>
  
  <p>I'm using a generator for Oauth signature and it's working in GET request as pointed out. <a href="https://www.npmjs.com/package/oauth-signature" rel="nofollow noreferrer">https://www.npmjs.com/package/oauth-signature</a></p>
  
  <p>Here's the code for the get and post requests:</p>
  
  <pre><code>getRequest = () =&gt; {
      const requestParams = { ...this.state.parameters }
      requestParams.oauth_nonce = this.generateNonce()
      requestParams.oauth_timestamp = new Date()
        .getTime()
        .toString()
        .slice(0,10)
      const encodedSignature = oauthSignature.generate(
        'GET',
        'http://localhost/wordpress-api/wp-json/wp/v2/posts/29',
        requestParams,
        this.state.consumerSecret,
        this.state.tokenSecret
      )
  
      axios({
        url: 'http://localhost/wordpress-api/wp-json/wp/v2/posts/29',
        method: 'get',
        auth: `
          OAuth oauth_consumer_key="${requestParams.oauth_consumer_key}",
          oauth_token="${requestParams.oauth_token}",
          oauth_signature_method="${requestParams.oauth_signature_method}",
          oauth_timestamp="${requestParams.oauth_timestamp}",
          oauth_nonce="${requestParams.oauth_nonce}",
          oauth_version="${requestParams.oauth_version}",
          oauth_signature="${encodedSignature}"
        `
      })
        .then(res =&gt; {
          this.setState({
            requestResponse: res
          })
        })
    }
  
  postRequest = (e) =&gt; {
      e.preventDefault()
  
      const postData = {
        title: this.refs.title.value,
        status: 'publish',
        content: this.refs.content.value,
      }
  
      const requestParams = { ...this.state.parameters }
      requestParams.oauth_nonce = this.generateNonce()
      requestParams.oauth_timestamp = new Date()
        .getTime()
        .toString()
        .slice(0,10)
      const encodedSignature = oauthSignature.generate(
        'POST',
        'http://localhost/wordpress-api/wp-json/wp/v2/posts',
        requestParams,
        this.state.consumerSecret,
        this.state.tokenSecret
      )
  
      axios({
        url: 'http://localhost/wordpress-api/wp-json/wp/v2/posts',
        method: 'post',
        data: postData,
        auth: `
          OAuth oauth_consumer_key="${requestParams.oauth_consumer_key}",
          oauth_token="${requestParams.oauth_token}",
          oauth_signature_method="${requestParams.oauth_signature_method}",
          oauth_timestamp="${requestParams.oauth_timestamp}",
          oauth_nonce="${requestParams.oauth_nonce}",
          oauth_version="${requestParams.oauth_version}",
          oauth_signature="${encodedSignature}"
        `
      })
        .then(res =&gt; {
          this.setState({
            requestResponse: res
          })
        })
    }
  </code></pre>