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

  • Home
  • SEARCH
  • 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 9237341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:30:52+00:00 2026-06-18T07:30:52+00:00

I implemented django-social-auth and got it to authenticate me with Facebook. I would like

  • 0

I implemented django-social-auth and got it to authenticate me with Facebook.

I would like it to also create a new user in the system, and write the email, name, and phone number if possible.

However, each time i log in with a user, it keeps overwriting the root user and not creating a new user?

I am also using a custom authentication module, and it’s not creating a user in the custom model.

Settings.py:

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'something.urls'

WSGI_APPLICATION = 'something.wsgi.application'

TEMPLATE_DIRS = (
    templatedir
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'frontpage',
    'social_auth',
    'django.contrib.admin'
)

AUTHENTICATION_BACKENDS = (
    'something.auth_backends.CustomUserModelBackend',
    'social_auth.backends.twitter.TwitterBackend',
    'social_auth.backends.facebook.FacebookBackend',
)

CUSTOM_USER_MODEL = 'accounts.CustomUser'
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/newuser/'
SOCIAL_AUTH_DISCONNECT_REDIRECT_URL = '/disconnected/'
SOCUAL_AUTH_USER_MODEL = 'accounts.CustomUser'
SOCIAL_AUTH_CREATE_USERS = True

FACEBOOK_APP_ID = 'XXX'
FACEBOOK_API_SECRET = 'XXX'
FACEBOOK_EXTENDED_PERMISSIONS = ['email','user_birthday','user_hometown','user_location','user_about_me']


LOGIN_URL = '/'
LOGIN_REDIRECT_URL = '/home/'
LOGIN_ERROR_URL = '/login-error/'
SOCIAL_AUTH_DEFAULT_USERNAME = 'social_auth_user'
SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter','facebook','google')

TWITTER_CONSUMER_KEY = 'XXX'
TWITTER_CONSUMER_SECRET = 'XXX'

URL’s.py

from django.conf.urls import patterns, include, url
from django.contrib.auth.views import login, logout

from frontpage.views import LoginPage, FrontPageView
from frontpage import views
from django.contrib import admin


from social_auth import __version__ as version
from social_auth.utils import setting

admin.autodiscover()

urlpatterns = patterns('',
    url(r'', include('social_auth.urls')),
    url(r'^$', views.LoginPage, name='LoginPage'),
    url(r'^login/$', views.loginreq, name='loginreq'),
    url(r'^newuser/$', views.newuser, name='newuser'),
    url(r'^logout/$', views.logout, name='logout'),
    url(r'^home/$', views.HomePage, name='HomePage'),
    url(r'^jobs/offers$', views.jobsoffers, name='jobsoffers'),
    url(r'^jobs/view$', views.jobsview, name='jobsview'),
    #url(r'^home/$', FrontPageView.as_view(), name='front_list'),
    (r'^admin/jsi18n/$', 'django.views.i18n.javascript_catalog'),

    # Examples:
    # url(r'^$', 'something.views.home', name='home'),
    # url(r'^something/', include('something.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
)

Views.py

class FrontPageView(ListView):
    context_object_name = 'front_list'
    template_name = 'homepage.html'
    queryset = classifield.objects.all()

    def get_context_data(self, **kwargs):
        context = super(FrontPageView, self).get_context_data(**kwargs)
        context['offers'] = offers.objects.all()
        return context

def logout(request):
    auth_logout(request)
    return HttpResponseRedirect('/')

def LoginPage(request):
    classifield_list = classifield.objects.all()
    offers_list = offers.objects.all()
    return render_to_response("login.html", {'classifield_list': classifield_list,'offers_list':offers_list}, context_instance=RequestContext(request))

@login_required
def HomePage(request):
    classifield_list = classifield.objects.all()
    ctx = {'last_login':request.session.get('social_auth_login_backend')}
    return render_to_response("homepage.html", {'classifield_list': classifield_list, 'ctx':ctx}, context_instance=RequestContext(request))
  • 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-06-18T07:30:53+00:00Added an answer on June 18, 2026 at 7:30 am

    Ok, to anyone else who gest stuck with this:
    DONT LOG IN TO THE ADMIN!
    Since you’re logged in to the admin, it keeps overwriting your admin user.
    Log out of the admin, and it will work!
    Yeeey!

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

Sidebar

Related Questions

I implemented a django custom authentication backend. My authenticate() returns a user object like
I have implemented a registration/login/authentication system using this Django guide . But, how would
I implemented the user login/registration using Django's authentication system but hit the wall and
I tried django-social-auth and googleappsauth but both allow me to authenticate from any domain.
I am trying to use django-social-auth to implement google openid login into my app,
Looking in django.conf I noticed that settings are implemented like this: class LazySettings(LazyObject): ...
In django, I would like to reference the class whose method is being called,
Implemented a new feature on the site as if it were a social network.
I want to replace settings.py in my Django system with a module implemented as
I have implemented a password recovery functionality in django. With my method, the new

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.