How to keep Twitter API session alive after logging through Facebook API?

六月ゝ 毕业季﹏ 提交于 2019-12-02 10:33:38

After debugging his application it turned out his Facebook was setup to redirect to his www subdomain, while Twitter was setup to redirect to no subdomain. The session was lost since the cookie was issued on a strict basis.

So after logging in via Facebook the user was taken to www which issued one session/cookie, after logging via Twitter the user was taken to plain domain, where a completely different session/cookie was being issued/presented.

Solutions to the problem:

  1. Wildcard cookie session_set_cookie_params( 0, '/', '.mywebsite.com' );
  2. Better solution - don't mix and match subdomains, set one canonical URL and stick to it.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!