jwt-guard
jwt-guard copied to clipboard
Token validation doesn't return the proper cause on response
The route in the package is not refreshing valid tokens. How do I procede?
Hi @petrisrf do you mean this action? https://github.com/paulvl/jwt-guard/blob/master/src/Foundation/Auth/AuthenticatesUsers.php#L52 are you getting some error or something registered in your log??
I'm receiving 401 as response, but the token did not expired yet. Is there any prerequisite to refresh a token?
Mmm.. as we can see here https://github.com/paulvl/jwt-guard/blob/master/src/Foundation/Auth/AuthenticatesUsers.php#L54 the refresh function validates the token on this function https://github.com/paulvl/jwt-guard/blob/master/src/Auth/JWTGuard.php#L36 the validation in fact must return an absolute "true" value to be valid any other case will cause the refresh function return null and as this condition resolves https://github.com/paulvl/jwt-guard/blob/master/src/Foundation/Auth/AuthenticatesUsers.php#L56 causes a 401 response, but! the validation function gives a reason as you can see here https://github.com/paulvl/jwt-guard/blob/master/src/Auth/JWTGuardTrait.php#L93 so that reason needs to be returned instead of "Unauthorized" error message. I will work on this.