0

I try to build some minimalistic example of github autentification with social_auth. I do everything like in documents but have some problem. Can anybody explain how to determine this problem?

This is my setting accorded to social_auth:

AUTHENTIFICATION_BACKENDS =(
        'social_auth.backends.contrib.github.GithubBackend',
        'django.contrib.auth.backends.ModelBackend',
    )

GITHUB_API_ID = 'key' # i hide the key
GITHUB_API_SECRET = 'secret' # i hide the secret

LOGIN_URL = reverse_lazy('account:login')
LOGIN_REDIRECT_URL = reverse_lazy('account:hello')
LOGIN_ERROR_URL = reverse_lazy('account:login_error')

SOCIAL_AUTH_DEFAULT_USERNAME = 'new_social_auth_user'

AUTH_USER_MODEL = 'auth.User'
SOCIAL_AUTH_USER_MODEL = 'auth.User'

SOCIAL_AUTH_RAISE_EXCEPTIONS = True


TEMPLATE_CONTEXT_PROCESSORS = ( 
    'social_auth.context_processors.social_auth_by_name_backends',
    'social_auth.context_processors.social_auth_backends',
    #'social_auth.context_processors.social_auth_by_type_backends',
    'social_auth.context_processors.social_auth_login_redirect',
)
INSTALLED_APPS = (
    # native
    'django.contrib.auth',
    ...
    'social_auth',
    # own
    'account',
)
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'social_auth.middleware.SocialAuthExceptionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

urls.py

urlpatterns = patterns('',                                                                   
    url(r'^$', HomeView.as_view(), name='home'),                                             
    url(r'^', include('account.urls', namespace='account')),                                 
    url(r'', include('social_auth.urls')),                                                   
)      

in settings of github application I wrote: The full URL to your application's homepage:

http://127.0.0.1:8000

Your application's callback URL; read our OAuth documentation for more information: http://127.0.0.1:8000/account/hello

And when I try to login via github I have a redirection to error page In server console I see:

[08/Aug/2013 06:47:24] "GET /sign-up/ HTTP/1.1" 200 898
[08/Aug/2013 06:47:26] "GET /login/github/ HTTP/1.1" 302 0
[08/Aug/2013 06:47:26] "GET /error/ HTTP/1.1" 200 17

Is anybody know how I can determine the root of the problem? Or how I can debug this problem? I tried to rewrite this code but have the same problem

kharandziuk
  • 12,020
  • 17
  • 63
  • 121

1 Answers1

0

Like the github application says:

The full URL to your application's homepage

http://127.0.0.1:8000 is pointing to the localhost. What you need is to put an ip or domain name that points to your server.

dan-klasson
  • 13,734
  • 14
  • 63
  • 101