• [ Moderator note: moved to Fixing WordPress. ]

    Hi guys,
    I need to enable REST API Services for my WP 4.8 but I have problem with AUTH.

    GET //wp-json/wp/v2/posts HTTP/1.1
    Host: www.xxxx.it
    Authorization: Basic YWRtaW46cGFzc3dvcmQ=
    

    works successfully

    POST /wp-json/wp/v2/posts HTTP/1.1
    Host: www.xxxxxxx.it
    Authorization: Basic YWRtaW46cGFzc3dvcmQ=
    Content-Type: application/json
    {
    	"content": "My content",
    	"title": "My title",
    	"excerpt": "My excerpt"
    }
    doesn't work
    
    I tried to modify the .htacces as read into many forum posts but the problem is not solved.
    
    

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    <IfModule mod_setenvif>
    SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1
    </IfModule>`

    or

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

    Could you please help me?

    Thanks

    • This topic was modified 7 years, 7 months ago by lsantaniello.
    • This topic was modified 7 years, 7 months ago by Jan Dembowski.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Rest API Authorization Problem’ is closed to new replies.