Tmeister / wp-api-jwt-auth

A simple plugin to add JSON Web Token (JWT) Authentication to WP REST API
GNU General Public License v2.0
556 stars 160 forks source link

Modify Error response message on /token API #296

Open abhijit-goswami opened 9 months ago

abhijit-goswami commented 9 months ago

Context

I’m using JWT to authenticate users from my app, and everything works as expected.

Is there a way I can modify the error response message in /token API?

image

I tried jwt_auth_token_before_sign and jwt_auth_token_before_dispatch filters but these only works if the credentials are valid.

nurullahturkoglu commented 6 months ago

You can modify the error message you want to give from line 147 in the public/class-jwt-auth-public.php file. If you have specific messages for certain situations, you can use a structure like switch-case.

answer-detail

abhijit-goswami commented 6 months ago

@nurullahturkoglu This can bs used as a fix but it's not a standard way to modify plugin files. I was actually asking for a hook.