views:

31

answers:

1

Hi,

I'm trying to replicate the functionality i've seen on a couple of sites:

The idea is you sign up and log in with Twitter using Oauth. Once you have authed the app at twitter you then return to their site and they keep you logged in. In the case of each one they obviously base this on cookies as i can return to the site after closing my browser and i am still logged in. This seems inherently insecure, what are they doing here to maintain the login?

I will be using Zend Framework but i guess that doesnt really matter.

+2  A: 

There's nothing wrong with using cookies. Tho you should encrypt the cookeis on server-side, so that a user cannot manipulate its value.

DASPRiD
in the case where you had - for example - an email address and an accessToken from Oauth then what would you recommend given that it would be necessary to encrypt and decrypyt?
seengee
Just encrypt both of them.
DASPRiD
can you recommend a good Zend Framework way of handling this?
seengee
There's nothing built-in in ZF for that purpose, but I wrote a small class in my blog to handle it: http://site.svn.dasprids.de/trunk/application/library/App/Cookie.php
DASPRiD
cool, is there a blog article about its usage too?
seengee
or just an example of its usage?
seengee
Nope, there isn't, just call App_Cookie::setBlowfishSecret('your-secret'); and then App_Cookie::setEncrypt($key, $value);
DASPRiD
where would it usually sit within a ZF MVC project - in the library?
seengee
Excatly, just see where I placed it.
DASPRiD
haha - didnt notice the path in the URL. thanks :)
seengee