t2v / play2-auth

Play2.x Authentication and Authorization module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Session works on localhost but not on server

somiclds opened this issue · comments

Authentication and authorization works just fine on localhost, but when I upload my application to production server - it fails.

LoginSucceeded gets called but when user is redirected to required page, authentication fails and user is redirected back to login (authenticationFailed triggers). Cookies and session storage stays empty.

How to solve that?

P.S. I am storing my application in virtual dedicated server. Maybe problem could be in caching?

Thanks.

Hi!
Maybe you have this line in config trait and delploy on server via

activator dist

 override lazy val tokenAccessor = new CookieTokenAccessor(
    cookieSecureOption = play.api.Play.isProd(play.api.Play.current),
    cookieMaxAge       = Some(sessionTimeoutInSeconds)
  )

cookieSecureOption = play.api.Play.isProd(play.api.Play.current)

If you are not using SSL then just set it to fasle

I didn't even had this line in my config. Now I have set cookieSecureOption to false as you said and everything works fine! Could you please explain me why it worked locally but not in server?

Thank you!