Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Status 401 / Not allowed to Edit #44

Closed
Mojo90 opened this issue May 3, 2016 · 4 comments
Closed

Status 401 / Not allowed to Edit #44

Mojo90 opened this issue May 3, 2016 · 4 comments

Comments

@Mojo90
Copy link

Mojo90 commented May 3, 2016

Hi there,
I have always an Authentication Error with my WP-Blog. I thought it could be the same error as Issue #25 but below you can see the Output of my header. So this could not be the problem. (XXX is the base64 encoded username:password).
Any other ideas to try out?

curl -v --header "Authorization: Basic XXX" -X POST -d "title=New Title" http://www.hyphy.de/wp-json-v2/wp/v2/posts/3526

  • Trying 81.169.145.159...
  • Connected to www.hyphy.de (81.169.145.159) port 80 (#0)

    POST /wp-json-v2/wp/v2/posts/3526 HTTP/1.1
    Host: www.hyphy.de
    User-Agent: curl/7.43.0
    Accept: /
    Authorization: Basic XXX
    Content-Length: 15
    Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 15 out of 15 bytes
    < HTTP/1.1 401 Unauthorized
    < Date: Tue, 03 May 2016 10:13:17 GMT
    < Server: Apache/2.2.31 (Unix)
    < X-Powered-By: PHP/5.5.34
    < X-Content-Type-Options: nosniff
    < Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
    < Access-Control-Allow-Headers: Authorization
    < Transfer-Encoding: chunked
    < Content-Type: application/json; charset=UTF-8
    <
  • Connection #0 to host www.hyphy.de left intact
    {"code":"rest_cannot_edit","message":"Sorry, you are not allowed to update this post.","data":{"status":401}}
@Mojo90
Copy link
Author

Mojo90 commented May 13, 2016

Fixed it by myself thanks to this post:
WP-API/Basic-Auth#1

Changing .htaccess did the Trick for me:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

@Mojo90 Mojo90 closed this as completed May 13, 2016
@Mojo90
Copy link
Author

Mojo90 commented Jun 4, 2016

Not sure what I changed but I have now the same Error again.
I changed my domain from .de to .rocks and using W3 Total Cache (not sure if that creates some dependencies).
Does anybody have some hints? Tried a lot but it is always the same error again as described above :-(

@Mojo90 Mojo90 reopened this Jun 4, 2016
@Ravenna
Copy link

Ravenna commented Aug 15, 2016

Been battling this one for 24 hours. the .htaccess fix helped this work.

@Mojo90
Copy link
Author

Mojo90 commented Aug 15, 2016

Yes this was a hard one for me as well 😄 now we developed our own system and do not need WP anymore for this project...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants