2

I have been struggling to implement facebook authentication with socialauth on a Django project. I keep getting this error:

NoReverseMatch at /mysite/test
Reverse for 'socialauth_begin' with arguments '(u'facebook',)' and keyword arguments '{}' not found.
Request Method: GET
Request URL:    http://127.0.0.1:8000/mysite/test
Django Version: 1.5.1
Exception Type: NoReverseMatch
Exception Value:    
Reverse for 'socialauth_begin' with arguments '(u'facebook',)' and keyword arguments '{}' not found.

I believe I have configured socialauth correctly (this guide helped), but I do not know where the error could be coming from.

This line in my template test.html is giving me issues:

<a href="{% url 'socialauth_begin' 'facebook' %}">Login with Facebook</a>

I have looked many places online and could not find a reasonable solution.

Kale Smith
  • 21
  • 2
  • 2
    Try it without quotes around `socialauth_begin`: `{% url socialauth_begin "facebook" %}` – David Robinson May 12 '13 at 21:18
  • I have tried that. It appears this issue has cropped up before with older versions of Django. You can see I'm running 1.5.1 which means that the quotes are necessary – Kale Smith May 12 '13 at 21:22
  • 1
    Check, have you included social_auth urls in your `urls.py` file: `url(r'', include('social_auth.urls')),`, as it written in step 4 from guide you've mentioned. And also, have you set in settings.py facebook params: `FACEBOOK_APP_ID` and `FACEBOOK_API_SECRET` – stalk May 12 '13 at 21:24
  • Yes, I've already done both. – Kale Smith May 12 '13 at 21:41
  • I used {% url 'socialauth_begin' "facebook" %} and this works for me running 1.5.1 – Glyn Jackson May 12 '13 at 22:54
  • I just tried that and I'm getting the same error. I wonder where the error could be occurring. It doesn't seem like much of the code I used is flawed since it was a bunch of copy pasta from working code... – Kale Smith May 12 '13 at 23:03
  • How was it installed? http://stackoverflow.com/questions/7004398/django-social-auth-app-not-working-under-virtualenv – Glyn Jackson May 12 '13 at 23:10
  • I used pip under virtualenv, and I use the socialauth_ prefix... – Kale Smith May 13 '13 at 02:59

1 Answers1

6

To save someone using the new python-social-auth and django > 1.4

Use this :

{% url 'social:begin' 'facebook' %}
Bwire
  • 1,181
  • 1
  • 14
  • 25
  • Thanks! This worked. The issue is the difference between the new python-social-auth urls and the older django-social-auth urls. – Tom Gruner Jul 23 '14 at 14:38