You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Jeff Charette <io...@yahoo.com> on 2013/02/28 00:00:55 UTC
tracking a guest session
So this seems like it should be pretty easy, but alas a google around the webosphere later I have no answer.
What id do most people use to track a user session for a user who is not logged in. My use case is adding some documents to a database with the session id, then updating the owner once the user logs in. Think shopping cart.
AuthSession is blank of course when not logged in.
Hope I am not asking this wrong :)
Jeff Charette | Principal
We Are Charette
web / identity / packaging
m 415.298.2707
w wearecharette.com
e jeffrey@wearecharette.com
Re: tracking a guest session
Posted by Travis Paul <Tr...@visPaul.me>.
I sometime keep client side session-ish data (App preferences etc) in
LocalStorage as its supported as far back as IE8.
https://developer.mozilla.org/en-US/docs/DOM/Storage#localStorage
Not sure if that helps you at all.
On Wed, Feb 27, 2013 at 8:16 PM, Jeff Charette <io...@yahoo.com> wrote:
> The best answer I have found is to implement my own cookie handler. Would
> be awesome if couch handled a session id for guests!
>
> This was a ton of help
> http://kan.so/packages/details/cookies
>
> require the cookie package
>
> Then in a show
>
> /* set cookie for first request */
> if (typeof req.cookie.wc_guest === 'undefined') {
> cookies.setResponseCookie(req, res, opt);
> }
> else {
> if (!res.headers) {
> res.headers = {};
> }
> res.headers['Set-Cookie'] = req.cookie.wc_guest;
> }
>
> That gets me started!
>
> Jeff Charette | Principal
> We Are Charette
> web / identity / packaging
>
> m 415.298.2707
> w wearecharette.com
> e jeffrey@wearecharette.com
>
> On Feb 27, 2013, at 6:00 PM, Jeff Charette <io...@yahoo.com> wrote:
>
> > So this seems like it should be pretty easy, but alas a google around
> the webosphere later I have no answer.
> >
> > What id do most people use to track a user session for a user who is not
> logged in. My use case is adding some documents to a database with the
> session id, then updating the owner once the user logs in. Think shopping
> cart.
> >
> > AuthSession is blank of course when not logged in.
> >
> > Hope I am not asking this wrong :)
> >
> > Jeff Charette | Principal
> > We Are Charette
> > web / identity / packaging
> >
> > m 415.298.2707
> > w wearecharette.com
> > e jeffrey@wearecharette.com
>
>
Re: tracking a guest session
Posted by Jeff Charette <io...@yahoo.com>.
The best answer I have found is to implement my own cookie handler. Would be awesome if couch handled a session id for guests!
This was a ton of help
http://kan.so/packages/details/cookies
require the cookie package
Then in a show
/* set cookie for first request */
if (typeof req.cookie.wc_guest === 'undefined') {
cookies.setResponseCookie(req, res, opt);
}
else {
if (!res.headers) {
res.headers = {};
}
res.headers['Set-Cookie'] = req.cookie.wc_guest;
}
That gets me started!
Jeff Charette | Principal
We Are Charette
web / identity / packaging
m 415.298.2707
w wearecharette.com
e jeffrey@wearecharette.com
On Feb 27, 2013, at 6:00 PM, Jeff Charette <io...@yahoo.com> wrote:
> So this seems like it should be pretty easy, but alas a google around the webosphere later I have no answer.
>
> What id do most people use to track a user session for a user who is not logged in. My use case is adding some documents to a database with the session id, then updating the owner once the user logs in. Think shopping cart.
>
> AuthSession is blank of course when not logged in.
>
> Hope I am not asking this wrong :)
>
> Jeff Charette | Principal
> We Are Charette
> web / identity / packaging
>
> m 415.298.2707
> w wearecharette.com
> e jeffrey@wearecharette.com