0

I can fetch entries using Bearer token from one my of my apps if the .htaccess file has the following lines in that specific order:

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]

But if I try to access it via cURL, using Basic Auth, I get:

{"code":"jwt_auth_bad_auth_header","message":"Authorization header malformed.","data":{"status":403}}

Now to avoid that, when I go back to .htaccess file and reverse the positions of the lines above, so that the first one comes last, and last first - the basic auth request works well and returns resources requested, but at the same time, the other app that users Bearer token doesnt work:

RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
RewriteCond %{HTTP:Authorization} ^(.*)

I've been going over this almost all day. Please help. Thanks! (NB: I really need to be able to authorise with both Basic and Bearer token). Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.