omab / django-social-auth

Django social authentication made simple
https://groups.google.com/group/django-social-auth
BSD 3-Clause "New" or "Revised" License
2.65k stars 756 forks source link

[backends] Added better error handling when parsing the <backend>_EXTRA_DATA setting #766

Closed emilisto closed 11 years ago

emilisto commented 11 years ago

I ran into some very confusing errors when setting the FOO_EXTRA_DATA variable in settings.py. First, there's a bug if you set

FOO_EXTRA_DATA = [
    ('user',)
]

Since the unpacking is faulty: name = alias = entry when it should instead be (name,) = (alias,) = entry.

Secondly, certain configuration errors result in a TypeError being thrown — which is unfortunately swallowed by Django's auth module. I re-worked the whole logic so that it's more thorough, and always gives visible exceptions — by instead throwing a BackendException that I introduced.

Also, I made the following work:

FOO_EXTRA_DATA = [ 'user' ]

Note: FOO goes for any backend, in my case I used the Instagram one.

omab commented 11 years ago

Thanks!

emilisto commented 11 years ago

Thank you too for a great package!