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'm sorry, but I'm new to HapiJS, and I don't truly understand how responseFunc works.
I want to return new token in every response, so I created a function:
function refreshSession(request, reply) {
const { response } = request;
const { exp, userId } = request.auth.credentials;
// if token has expiry date then create and send new session token with each request
if (exp) {
response.header('Authorization', session.create(userId));
}
reply.continue(); // < --- is it correct?
}
Documentation says: reply(err, response) - is called if an error occurred.
So I've tried many variations with passing arguments to reply, but it never worked properly.
I'm asking to be sure if above is right or it if has some hidden pitfalls.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
No. I'm doing it when user doesn't want to have "infinite" session. Then session token stays valid for ~2hours, I'm returning new to maintain 2h from last request.
I'm sorry, but I'm new to HapiJS, and I don't truly understand how
responseFunc
works.I want to return new token in every response, so I created a function:
Documentation says:
reply(err, response)
- is called if an error occurred.So I've tried many variations with passing arguments to reply, but it never worked properly.
I'm asking to be sure if above is right or it if has some hidden pitfalls.
Thanks in advance.
The text was updated successfully, but these errors were encountered: