JWT Authentication for WP REST API setup

I am trying to use JWT Authentication for WP REST API. I am able to generate bearer tokens and validate them using POST /jwt-auth/v1/token and also validate the token using POST /jwt-auth/v1/token/validate.

When I try to use WP REST API from another application, I get the following error:

{
    "code": "jwt_auth_bad_config",
    "message": "JWT is not configurated properly, please contact the admin",
    "data": {
        "status": 403
    }
}

I have followed the setup instruction, but there is one part that asks to modify .htaccess.

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

But since DevKinsta uses nginx instead of apache there is no .htaccess I can find.

I found this issue Directive for NGINX · Issue #194 · Tmeister/wp-api-jwt-auth · GitHub

fastcgi_pass_header Authorization;

How can I add this to the nginx config in DevKinsta?

Hi @Gregory_Saumier-Finc ! We can indeed edit the nginx configuration, however keep in mind that restarting nginx will revert the configuration our default. Here’s a guide on that.

We do have this feature request here. Another thing to note is that nginx configurations are not transferrable to or from Kinsta’s live sites.

We haven’t heard back from you on this topic in a while. However, if you do need further assistance you can simply start a new forum thread. Thank you again for using DevKinsta. Let us know if you need further assistance! :wave: