tschellenbach / Django-facebook

Facebook open graph api implementation using the Django web framework in python
http://www.mellowmorning.com/
Other
1.43k stars 544 forks source link

Can't login using Facebook #409

Open syedz opened 10 years ago

syedz commented 10 years ago

I have all of the tables created, but I'm getting the following error when I go to /facebook/example and try to login using Facebook. It recognizes that I have an account created and logged in as, but even when I attempt to connect the account to Facebook I get the same error.

If you could give me some suggestions, I would really appreciate that.

Environment:

Request Method: POST Request URL: http://localhost:9000/facebook/connect/

Django Version: 1.5.2 Python Version: 2.7.2 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'django_extensions', 'django_facebook', 'cleancreds', 'cleanteams', 'challenges', 'south', 'storages', 'users', 'userorganization', 'userprofile') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

Traceback: File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, _callback_args, *_callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  2. return view_func(_args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/decorators.py" in wrapped_view
  3. response = self.authenticate(self.fn, request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/decorators.py" in authenticate
  4. request, redirect_uri=redirect_uri) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in require_persistent_graph
  5. graph = get_persistent_graph(request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in get_persistent_graph
  6. graph = get_facebook_graph(request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in get_facebook_graph
  7. signed_data = parse_signed_request(signed_request_string) File "/Library/Python/2.7/site-packages/django_facebook/utils.py" in parse_signed_request
  8. signed_request_string) File "/Library/Python/2.7/site-packages/open_facebook/api.py" in parse_signed_data
  9. digestmod=hashlib.sha256).digest() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py" in new
  10. return HMAC(key, msg, digestmod) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py" in init
  11. if len(key) > blocksize:

Exception Type: TypeError at /facebook/connect/ Exception Value: object of type 'NoneType' has no len()

tschellenbach commented 10 years ago

I dont see anything obviously wrong. Any tips on how I can reproduce this? On Dec 22, 2013 10:49 PM, "syedz" notifications@github.com wrote:

I have all of the tables created, but I'm getting the following error when I go to /facebook/example and try to login using Facebook. It recognizes that I have an account created and logged in as, but even when I attempt to connect the account to Facebook I get the same error.

If you could give me some suggestions, I would really appreciate that.

Environment:

Request Method: POST Request URL: http://localhost:9000/facebook/connect/

Django Version: 1.5.2 Python Version: 2.7.2 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'django_extensions', 'django_facebook', 'cleancreds', 'cleanteams', 'challenges', 'south', 'storages', 'users', 'userorganization', 'userprofile') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

Traceback: File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, _callback_args, *_callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  2. return view_func(_args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/decorators.py" in wrapped_view
  3. response = self.authenticate(self.fn, request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/decorators.py" in authenticate
  4. request, redirect_uri=redirect_uri) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in require_persistent_graph
  5. graph = get_persistent_graph(request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in get_persistent_graph
  6. graph = get_facebook_graph(request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in get_facebook_graph
  7. signed_data = parse_signed_request(signed_request_string) File "/Library/Python/2.7/site-packages/django_facebook/utils.py" in parse_signed_request
  8. signed_request_string) File "/Library/Python/2.7/site-packages/open_facebook/api.py" in parse_signed_data
  9. digestmod=hashlib.sha256).digest() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py" in new
  10. return HMAC(key, msg, digestmod) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py" in init
  11. if len(key) > blocksize:

Exception Type: TypeError at /facebook/connect/ Exception Value: object of type 'NoneType' has no len()

— Reply to this email directly or view it on GitHubhttps://github.com/tschellenbach/Django-facebook/issues/409 .

syedz commented 10 years ago

Sorry not sure if this help. If you go to /facebook/connect and click on Login with Facebook, you valid and then Django redirects you here.

tschellenbach commented 10 years ago

Could you try the Facebook login on fashiolista.com?

Maybe its somehow related to ur fb data. On Dec 22, 2013 10:49 PM, "syedz" notifications@github.com wrote:

I have all of the tables created, but I'm getting the following error when I go to /facebook/example and try to login using Facebook. It recognizes that I have an account created and logged in as, but even when I attempt to connect the account to Facebook I get the same error.

If you could give me some suggestions, I would really appreciate that.

Environment:

Request Method: POST Request URL: http://localhost:9000/facebook/connect/

Django Version: 1.5.2 Python Version: 2.7.2 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'django_extensions', 'django_facebook', 'cleancreds', 'cleanteams', 'challenges', 'south', 'storages', 'users', 'userorganization', 'userprofile') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

Traceback: File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, _callback_args, *_callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  2. return view_func(_args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/decorators.py" in wrapped_view
  3. response = self.authenticate(self.fn, request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/decorators.py" in authenticate
  4. request, redirect_uri=redirect_uri) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in require_persistent_graph
  5. graph = get_persistent_graph(request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in get_persistent_graph
  6. graph = get_facebook_graph(request, _args, *_kwargs) File "/Library/Python/2.7/site-packages/django_facebook/api.py" in get_facebook_graph
  7. signed_data = parse_signed_request(signed_request_string) File "/Library/Python/2.7/site-packages/django_facebook/utils.py" in parse_signed_request
  8. signed_request_string) File "/Library/Python/2.7/site-packages/open_facebook/api.py" in parse_signed_data
  9. digestmod=hashlib.sha256).digest() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py" in new
  10. return HMAC(key, msg, digestmod) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py" in init
  11. if len(key) > blocksize:

Exception Type: TypeError at /facebook/connect/ Exception Value: object of type 'NoneType' has no len()

— Reply to this email directly or view it on GitHubhttps://github.com/tschellenbach/Django-facebook/issues/409 .

syedz commented 10 years ago

That one worked really nicely. Got the email and everything.

tschellenbach commented 10 years ago

Same python, same django, same facebook data.... which version of django facebook are you on?

syedz commented 10 years ago

django-facebook==5.3.1

syedz commented 10 years ago

Not sure if this will help, but you can recreate the problem here.

http://mycleancity-staging.herokuapp.com/facebook/example

b10n1k commented 10 years ago

Same issue here with the same version of django-facebook and django 1.6.1.

guialante commented 10 years ago

Have you try with virtualenv to probe the project in a "clean" python envirotment, I have same django version, and django-facebook and everything is ok

carver commented 10 years ago

We're seeing the same issue in production with versions:

Django==1.5.5
django-facebook==5.2.6
dkdndes commented 10 years ago

Check if FACEBOOK_APP_SECRET is set properly - if not you might get the following error: File "/usr/lib/python2.7/hmac.py", line 68, in init if len(key) > blocksize: which is required in django_facebook/api.py