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
560 stars 161 forks source link

function validate_token is not checking whether token is expired in class-jwt-auth-public.php #164

Closed prafullwizorbit closed 5 years ago

prafullwizorbit commented 5 years ago

Hello i think i am facing a problem what happened with me, this plugin was working well but after 7 days there is no any response from token validate function, because after 7 days still token is present in cookie but it is expired & when this is served as bearer then validate_token function doesn't give any response. this may be because there is no any condition is set for checking expiry time in validate_token function that exist in class-jwt-auth-public.php

Here is function ` public function validate_token($output = true) { /*

Can any one help me how to validate expiry token in every bearer token request.

Thanks.

prafullwizorbit commented 5 years ago

ok i found the answer actually jwt checking well for token expiry but it should be return in same way as token validate state like this way my code working well } catch (Exception $e) { /* Something is wrong trying to decode the token, send back the error / return array( 'code' => 'jwt_auth_invalid_token', 'data' => array( 'code' => $e->getMessage(), 'status' => 403, ), ); }