Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Rest API Authorization Problem

$
0
0

Replies: 0

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


Viewing all articles
Browse latest Browse all 59525

Trending Articles