Tuesday, December 24, 2013

Re: django 1.6 + django-allauth facebook authentication error

facebook can indeed redirect to localhost, I've done it before, the problem is:
1 - you need to use localhost, 12.7.0.0.1 won't work
2 - you need a separate app id for that, just create a general one for localhost development


On Tue, Dec 24, 2013 at 11:58 AM, Timothy W. Cook <tim@mlhim.org> wrote:
My guess is because FB can't redirect to a localhost URL. You could probably use something like no-ip.org and setup a reachable URL.

HTH,
Tim



On Tue, Dec 24, 2013 at 5:05 AM, Nobin Mathew <nobin.mathew@gmail.com> wrote:
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.



--
MLHIM VIP Signup: http://goo.gl/22B0U
============================================
Timothy Cook, MSc           +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

--
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/CA%2B%3DOU3V9n23Wep17u%2B6V3Fe-sKii-Nf1juu-30jU4yAM_eXo6A%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
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/CAFWa6tJAJZFVhLa%2BXx%2B2zCtKjFhnCY2eh%2BSGBrFLUE6GBp4NEw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment