-
Notifications
You must be signed in to change notification settings - Fork 21
4. Session
leonardo Rico edited this page Jan 21, 2018
·
3 revisions
When you log in correctly the information arrives here: /src/auth/services/session.js
- err: errors
- user: user from data base
- res: response
let ttl = calc(time(config.roles, user.roles), 'max');
More info: role-calc
const token = await r.sign(user._id.toString(), { // id user
ttl: '15 minutes',// examples: 50 seconds, 10 minutes, 5 hours, 3 days
dataSession: { obj }, // save data in REDIS (Private)
dataToken: { obj }, // save data in Token (Public)
});
More info: redis-jwt
- The generated token will be returned for the client to store in localstorage or cookies
- The token will be sent in the "Authorization" header on each request from client, to see how to extract it and validate, see Middleware
Nodetomic Api Swagger