title: Authorization header malformed on post request with Basic auth (JavaScript)
body: <p>I am trying to create a new user on a wordpress site remotely, I am using the rest api available natively on all wp websites, the issue I am having is that in order to create new user you have to authenticate using an administrator account, when sending the request I got the error:</p>
  
  <pre><code>Object {
    "code": "jwt_auth_bad_auth_header",
    "data": Object {
      "status": 403,
    },
    "message": "Authorization header malformed.",
  }
  </code></pre>
  
  <p>My function is all fine except those headers if anybody can help</p>
  
  <pre><code>signup = (e) =&gt; {
      let { username, email, password, password2 } = this.state
      if (username !== '' &amp;&amp; email !== '' &amp;&amp; password !== '') {
        if (password === password2) {
          this.setState({ loading: true, error: null })
          var auth = 'Basic ' + Base64.encode('coolusername' + ':' + 'securepassword')
          console.log(auth)
          var url = 'https://example.com'
          var request = new Request(url + '/wp-json/wp/v2/users', {
            method: 'POST',
            headers: new Headers({
              'Content-Type': 'application/json',
              'Authorization': auth
            }),
            body: JSON.stringify({
              username: username,
              email: email,
              password: password
            })
          })
          fetch(request)
            .then((response) =&gt; {
              response.json().then((results) =&gt; {
               // ...
              })
            })
            .catch(function (err) {
              console.log(err)
            })
        } else {
          this.setState({ error: 'Passwords do not match' })
        }
      } else {
        this.setState({ error: 'Error: Missing fields' })
      }
    }
  </code></pre>
  
  <p>The thing I believe is causing this error is that <code>'Authorization'</code> should be followed with base64 username:password but when I try to decode the string I have passed I obtain a different string not exactly what I have inputed, I have previously used <code>js-base64</code> npm library it works just fine.</p>