In django-social-auth, there are a few instances where a back-end will raise a ValueError (such as when a user cancels a login request or if a user tries to associate with an account that’s already been associated with another User). If a User runs into one of these scenarios, they’ll be presented with a 500 error on your site.
So, what’s the best way to catch these? I’d prefer to be able to display a useful message (via the messages framework) when this happens, but I’m at a loss as to the best way to do this.
I’m thinking about writing my own view (in a separate app) that just wraps social_auth‘s associate_complete view, but this seems clunky… Any ideas?
I could fork django-social-auth and customize this behavior, but I’d prefer not to maintain a separate fork – especially since I can’t assume everone would want to handle these Exceptions in the same manner.
I’ve ecountered the same problem and it seems, that creating wrapper view is the best way to handle this situation, at this point, atleast. Here is how I had mine done:
You will have to setup
urlfor it:And then use it as before in template:
Hope this helps, even aftern two months after question was asked 🙂