agiliq/Django-Socialauth

socialauth_facebook_login "next" url to include host name (patch included)

pennersr opened this issue · 1 comments

When using the "'socialauth_facebook_login" view to login to Facebook, the user is redirected to a wrong URL after a successful login. The reason is that the URL to redirect to ("next") is based on a Django URL reversal, resulting in an URL path only. Hence, you are redirected to an URL of the form http://www.facebook.com/{django-eversed-url-path}, which clearly does not exist.

See patch below:

--- Django-Socialauth/socialauth/views.py
+++ Django-Socialauth/socialauth/views.py
@@ -203,7 +203,7 @@
params = {}
params["api_key"] = settings.FACEBOOK_API_KEY
params["v"] = "1.0"

  • params["next"] = reverse("socialauth_facebook_login_done")[1:] # remove leading slash
  • params["next"] = 'http://%s%s' % (request.get_host(), reverse("socialauth_facebook_login_done"))
    params["canvas"] = "0"
    params["fbconnect"] = "1"

Cancel link must be a full URL

fixed