You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to implement refresh-token functionality for my app using hapi-auth-jwt2. What I was trying if token expires, trigger a refresh-token call to get a new token if user is still active from client side, and in validateFunc just bypass the expiration check and issue a new token from handler. But I get 401 'Invalid token' for the refresh-token without it calling validateFunc
var jwtValidate = function (decoded, request, callback) {
var expDate = decoded.exp * 1000;
if (request.path.indexOf('refreshToken') < 0) {
if (Date.now() > expDate) {
throw Boom.unauthorized('Token expired, please login again.');
}
var user = users.find(function(a){
return a[decoded.id]
});
if(user){
callback(null, true);
} else{
Boom.unauthorized('No such active user.');
}
}
};
Is this the expected behavior? if yes, how should I implement refresh functionality? I referred #237 which also depends on expDate.
The text was updated successfully, but these errors were encountered:
I was trying to implement refresh-token functionality for my app using hapi-auth-jwt2. What I was trying if token expires, trigger a refresh-token call to get a new token if user is still active from client side, and in validateFunc just bypass the expiration check and issue a new token from handler. But I get 401 'Invalid token' for the refresh-token without it calling validateFunc
Is this the expected behavior? if yes, how should I implement refresh functionality? I referred #237 which also depends on expDate.
The text was updated successfully, but these errors were encountered: