Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6356815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:02:33+00:00 2026-05-24T23:02:33+00:00

In django-social-auth , there are a few instances where a back-end will raise a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:02:35+00:00Added an answer on May 24, 2026 at 11:02 pm

    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:

    def social_auth_login(request, backend):
        """
            This view is a wrapper to social_auths auth
            It is required, because social_auth just throws ValueError and gets user to 500 error
            after every unexpected action. This view handles exceptions in human friendly way.
            See https://convore.com/django-social-auth/best-way-to-handle-exceptions/
        """
        from social_auth.views import auth
    
        try:
            # if everything is ok, then original view gets returned, no problem
            return auth(request, backend)
        except ValueError, error:
            # in case of errors, let's show a special page that will explain what happened
            return render_to_response('users/login_error.html',
                                      locals(),
                                      context_instance=RequestContext(request))
    

    You will have to setup url for it:

    urlpatterns = patterns('',
        # ...
        url(r'^social_auth_login/([a-z]+)$',  social_auth_login, name='users-social-auth-login'), 
    )
    

    And then use it as before in template:

    <a href="{% url 'users-social-auth-login' "google" %}">Log in with Google</a>
    

    Hope this helps, even aftern two months after question was asked 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using django-social-auth for facebook login. I am able to login user using
Am using django social-auth authentication for my app.After login to facebook or twitter from
I am trying to use django-social-auth to implement google openid login into my app,
I have started using https://github.com/omab/django-social-auth and been successfully able to login via twitter, google
Using django-social-auth to grab user data from facebook, it is returning a list of
We are using django and django-socialauth for auth with google/fb/twitter but there is a
django-social-auth redirects me to /mypage#_=_ when using the the Facebook backend. As I am
I use Django social-auth (omab version just to avoid any confusion with the other
Under Django 1.1.1, I am using several authentication backends such as social-registration for facebook
I tried django-social-auth and googleappsauth but both allow me to authenticate from any domain.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.