Django Sessions getting dropped when redirected from another domain

后端 未结 2 1674
忘掉有多难
忘掉有多难 2021-02-06 06:37

When a user visits my domain, a sessionid is issued by django. When he tries to do Oauth with Facebook, he clicks a button on my site which redirects to Facebook.com. Facebook r

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 07:23

    You might want to confirm that the cookies have the same domain when being created. That can sometimes cause problems. If you are going to the website www.example.com and the OAuth callback points to example.com, then it's possible you have two separate cookies, one for www.example.com and one for example.com

    Turn on "Always Ask" on your browser and pay attention to the cookie details. Make sure that the value for the "Host:" field is the same both times.

    The fix is entering something like .example.com for SESSION_COOKIE_DOMAIN in your settings.py file.

提交回复
热议问题