Monday, December 23, 2013

django 1.6 + django-allauth facebook authentication error

Hi,

I am writing a django website using django-allauth for facebook authentication.

When I sign into facebook(after giving username and passwd) from my local development server( `<`http://127.0.0.1:8001/gallery/`>` ) I get following error:

***************
Social Network Login Failure

An error occurred while attempting to login via your social network account.
***************

and url in browser while on this error is http://localhost:8001/gallery/accounts/facebook/login/callback/.


Settings:

Facebook.com app setting:
AppId =XXX(not shown)
APP secret =xxx(not shown)

Wbsite:Site URL = http://localhost:8001/gallery/accounts/facebook/login/callback/

Django setting(local):

LOGIN_REDIRECT_URL = 'http://localhost:8001/gallery/accounts/facebook/login/callback/'

    SOCIALACCOUNT_PROVIDERS = {
     'facebook': {
                'SCOPE': ['email', 'publish_stream'],
                'AUTH_PARAMS': { 'auth_type': 'reauthenticate' },
                'METHOD': 'oauth2'  # instead of 'oauth2'
     }
    }

ACCOUNT_LOGOUT_REDIRECT_URL = '/gallery'
SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_AUTO_SIGNUP = True
ACCOUNT_EMAIL_VERIFICATION = False



and my base.html template is (not full):
  <body>
                 {% load url from future %}
                 {% load socialaccount %}
                 {% if request.user.is_authenticated %}
                     <a href="{% url 'account_logout' %}">Logout</a>
                 {% else %}
                     <a href="{% url 'account_signup' %}">Sign Up</a>
                     <a href="{% url 'account_login' %}">Log in</a>
                     <a href="{% provider_login_url 'facebook' method='oauth2' %}">
                     Sign Up/Login with Facebook</a>
                 {% endif %}
  </body>   
  
        
          

When I am error page  http://localhost:8001/gallery/accounts/facebook/login/callback/ it says I am logged in (i.e. displays Logout and user is authenticated).

Any Idea why this happens? Any help will be appreciated.






--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aba71009-2066-48aa-8502-0e90699295e3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment