I just installed a new wp on dev server . I am trying to authenticate the rest of the api (plugin, since it is wp v.4.6.3), with an ionic / angular application that resides on my computer / device. Currently, the JWT Authentication for WP-API plugin is being used . This is my header using the HTTP Headers plugins:
content-encoding: gzip
x-powered-by: php/5.5.9-1ubuntu4.21
connection: keep-alive
content-length: 3361
keep-alive: timeout=5, max=95
access-control-allow-headers: accept, authorization, cache-control, cookie, content-type, origin
server: apache/2.4.7 (ubuntu)
x-frame-options: allow-from *
vary: accept-encoding
access-control-allow-methods: get, post, options, head, put, delete, trace, connect, patch
content-type: text/html; charset=utf-8
access-control-allow-origin: *
access-control-expose-headers: cache-control, cookie, content-type, origin
cache-control: no-cache, must-revalidate, max-age=0
No matter what I do, I get a CORS error. The most recent:
The Content-Type request header field is not allowed by Access-Control-Allow-Headers in the preflight response.
JWT .htaccess wp-config.php, . / htacces. .
JWT- (credentials/url valid!):
var apiHost = 'http://dev.imok.ro/authworks/wp-json';
$http.post( apiHost + '/jwt-auth/v1/token', {
username: 'admin',
password: 'admin!@#'
})
.then( function( response ) {
console.log( 'siker', response.data )
})
.catch( function( error ) {
console.error( 'Errorrrr', error );
});
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
RewriteEngine On
RewriteBase /authworks/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /authworks/index.php [L]
</IfModule>
!