Reading Authorization header for JWT Token using Laravel 5, CORS, and JWTAuth -
i'm having hard time figuring out. using jwtauth on laravel 5 api , i'm having problem token being read. know , tried:
i have set cors configuration allow headers api path:
return array( 'defaults' => array( 'supportscredentials' => false, 'allowedorigins' => array(), 'allowedheaders' => array(), 'allowedmethods' => array(), 'exposedheaders' => array(), 'maxage' => 0, 'hosts' => array(), ), 'paths' => array( 'api/*' => array( 'allowedorigins' => array('*'), 'allowedheaders' => array('*'), 'allowedmethods' => array('*'), 'maxage' => 3600, ), '*' => array( 'allowedorigins' => array('*'), 'allowedheaders' => array('content-type'), 'allowedmethods' => array('post', 'put', 'get', 'delete'), 'maxage' => 3600, 'hosts' => array('api.*'), ), ), );
i have added following apache's sites enabled conf file:
rewriteengine on rewritecond %{http:authorization} ^(.*) rewriterule .* - [e=http_authorization:%1]
and can see in chrome tools headers being passed correct token , in correct format: authorization : bearer tokenstring
can see may doing wrong? know of issues this?
i see issue is. according documentation on jwtauth github page:
note apache users
apache seems discard authorization header if not base64 encoded user/pass combo. fix can add following apache config
rewriteengine on rewritecond %{http:authorization} ^(.*) rewriterule .* - [e=http_authorization:%1]
i thought apache config meant 000-default.conf file. in error. in fact suppose done in .htaccess file. once done... poof, works!
Comments
Post a Comment