Skip to content

Instantly share code, notes, and snippets.

@stephen
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephen/b18d37a675fd37dfdf14 to your computer and use it in GitHub Desktop.
Save stephen/b18d37a675fd37dfdf14 to your computer and use it in GitHub Desktop.
Session.generate({ user: 'stephen' }, function(err, result) {
var token = result.token;
session.set('expirationTime', Date.now());
session.save(function(err, result) {
// re-fetch
Session.load(token, function(err, fetchedSession) {
// do something with the newly fetched instance
assert.equals(fetchedSession.get('user'), 'stephen');
fetchedSession.delete(function(err) {
// done
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment