Code Monkey home page Code Monkey logo

django-facebook's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-facebook's Issues

argument of type 'NoneType' is not iterable

Cloned the repo and got all the folders right, ran runserver no problems went to /facebook/connect the page comes up, the page show some of my testers photo's i click the Register, login or connect with facebook link, the window comes up i give the app permission and boom the django exception page is shown
TypeError at /facebook/connect/
argument of type 'NoneType' is not iterable

I traced it to the django_facebook/api.py line 209, somehow the sig and expected sig are not the same so it returns none and it all stops.
I tried it with another facebook account, same problem, i tried deleting the app from the facebook page and get new ID and SECRET but it also fails.
I cloned the repo today.

canvas page redirects don't work.

i know you're prob working on it.

this old code is what i used before....

fb_graph_access_url = 'https://graph.facebook.com/oauth/access_token?client_id=%s&redirect_uri=%s&client_secret=%s'%(client_id,redirect_url,client_secret)
# supported types: web_server, user_agent, client_cred, username
fb_graph_auth_url = 'https://graph.facebook.com/oauth/authorize?client_id=%s&redirect_uri=%s&scope=%s&display=page&type=web_server'%(client_id,redirect_url,perms)
redirect_script = '<script type="text/javascript">window.top.location.href="%s"</script>'%(fb_graph_auth_url);

KeyError when you don't ask for 'Email' permissions.

MultiValueDictKeyError at /
"Key 'email' not found in ...

Can we get some "try's" around this or similar?
I'd rather not ask for email permissions for every app, sometimes the default permissions are plenty.

Thanks, and great work!

Installation: additional instructions

Hi all,

First of all, thanks for this nice project. There are still many things to improve but it just works :)

I followed the install instructions from the README step-by-step, and still I had some errors will integrating Django-facebook to my project. Here is a list of the additional steps I needed to undertake:

  • Add not only 'django_facebook' but also the 'open_facebook' folder to my path
  • Add the 'facebook_example/registration' application to my project
  • Add the 'templates/registration' which are in 'facebook_example/members' to my templates collection
  • Specify the following additional settings:
REGISTRATION_BACKEND = 'registration.backends.default.DefaultBackend'
ACCOUNT_ACTIVATION_DAYS = 10

Of course everything's in 'facebook_example' but it would be nice (i.e. spare time to the next guys integrating Django-facebook in their projects) if these instructions could be added to the README as well.

No license specified

Better get a license figured out and posted in here, unless you don't plan on accepting code contributions or care if people use the code.

No module named registration.forms

Hi, I'm getting this error when I try to log in using Facebook. Does this module expect me to make my own registration form?

The effect I'm trying to achieve is to have a seamless login system without any registration forms. i.e. if a user allows my Facebook app access, a django user is automatically created for them / they are logged in under their already existing user account.

Thanks,
-George

fb-root in integration steps

I noticed that without adding

somewhere on my page logging in/registering/etc... would not work when following the steps to integrating django-facebook into your site.

The error could have been something else on my end but it seems that you do need the fb-root div. If this is the case I think it would be a good idea to add it to the docs to avoid confusion.

django-facebook does not work with latest django-registration

Mercurial django-registration changed its interface and forms does not have anymore a save method, so _register_user fails. I'm looking at fixing the issue calling the register() function of the used backend but have issues with get_backend atm. Also this may not be the right thing to do. Since this is the first time i poke with django-registration if anyone beats me to fixing the issue it would be much appreciated.

django_facebook.urls can't be resvered

This piece of stackstrace comes from ./manage.py dbshell

I've included django_facebook.urls in my root urls.py file

import django_facebook
reverse("django_facebook.urls")
Traceback (most recent call last):
File "", line 1, in
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/core/urlresolvers.py", line 391, in reverse
_args, *_kwargs)))
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/core/urlresolvers.py", line 312, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/core/urlresolvers.py", line 229, in _get_reverse_dict
self._populate()
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/core/urlresolvers.py", line 208, in _populate
for name in pattern.reverse_dict:
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/core/urlresolvers.py", line 229, in _get_reverse_dict
self._populate()
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/core/urlresolvers.py", line 220, in _populate
lookups.appendlist(pattern.callback, (bits, p_pattern))
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/core/urlresolvers.py", line 164, in _get_callback
self._callback = get_callable(self._callback_str)
File "/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django/utils/functional.py", line 122, in wrapper
if mem_args in cache:
TypeError: unhashable type: 'dict'

Error on example

Hi all, im using django 1.3 and the pip version of django-facebook.

After install and follow the steps when I log in in the /facebook/connect/ example, the website log me in correctly but after it tries to redirect me to a page with ?facebook_login=1 get parameter and then django crushes with:

OAuthException at /facebook/connect/

Error validating verification code.

Perhaps Im missing some setting config?

Any help would be appreciated :)

Jinja?

You may want to specify Jinja as a requirement...I can't use Jinja sadly so I can't use this library :(

Activation Email issue after Facebook Connect

I upgraded to the latest 3.2.5 and testing locally. After I Facebook Connect, the next page doesn't load. When I check terminal I see that the output of the activation email. I'm assuming its trying to send the email but failing and so doesn't load the next page either? Any way to fix this or turn off the activation email?

Missing info in readme

In your readme you suggest that we should add a some fields to our profile model. However your image field is missing an upload_to argument and that causes an error. However the image field in your abstract models.FacebookProfileModel is correct. Why not just direct users to use that as their base class? Either that, or you could just fix that line in the readme. Just a suggestion to avoid confusion.

Latest commit typo

Hi, i'm still not confident using git to commit to projects, but i found a typo in the latest commit, 83fa6ba.

In the first change of api.py you added
_add_current_user_id(graph, request.user)
But graph is undefined, i think you meant facebook_open_graph

Example requires Django 1.3.x

An example uses django.contrib.staticfiles - it's a 1.3 feature. Can django.views.static.serve be used instead?

modules.py uses receiver (from django.dispatch import receiver). It's a new 1.3 feature.

Return Registered and New Friends

Hi,

The function that is supposed to return registered and new friends works for returning registered friends but then then new friends returns all of your Facebook friends and doesn't exclude the registered ones. After doing some digging I figured out it is because registered_ids come from facebook_id in the UserProfile which is an integer and f['id'] is a string so you are comparing an integer to a string and so it is never true that f['id'] is in registered_ids.

Also a question for you. I don't think the Facebook image in the UserProfile is getting uploaded. I couldn't find anywhere it was doing this in the code. Is it supposed to or am I supposed to do that?

Thanks,
Kelly

Canvas page

django_facebook.views.canvas method doesn't pass facebook object in context to canvas template
and has invalid api call to open_facebook.
I changed it to something like:


def canvas(request):
    context = RequestContext(request)

    context['auth_url'] = generate_oauth_url()
    fb = get_persistent_graph(request)
    context['facebook'] = fb  # <----  pass facebook obj with context
    if fb.is_authenticated():
        likes = context['facebook'].get("me/likes", limit=3)   # <----- fix open_facebook call
        logger.info('found these likes %s', likes)

    return render_to_response('django_facebook/canvas.html', context)

Also django_facebook.canvas.generate_oauth_url doesn't work good with
facebook_settings.FACEBOOK_DEFAULT_SCOPE if it's defined as list.
Worked for me only after change to simple string:
FACEBOOK_DEFAULT_SCOPE = 'user_about_me, email, user_birthday'

struggling with server-side authentication

Hi Thierry,

I am hoping to get onto sorting out the permissions issue this week. Just struggling to use server side authentication through the API at the moment. I am creating an app request and trying to authorise the user when they accept the request. I can do it if I post the urls directly, something like....

https://graph.facebook.com/oauth/authorize?client_id=%s&redirect_uri=%s
https://graph.facebook.com/oauth/access_token?client_id=%s&redirect_uri=%s&client_secret=%s&code=%s
https://graph.facebook.com/me?client_id=%s&%s

I get the impression I can do it via the API with something like....
from django_facebook.api import get_facebook_graph
graph = get_facebook_graph(request)
logging.debug('RM: facebook %s' % str(graph.me()))

open_facebook.api says 'valid signed request received' but the parsed_data returned from it contains neither 'oauth_token' or 'code' and so get_facebook_graph returns None.

Am I missing a step in using the API? I want to get it working through the API so I can use the connect_user flow.

Thanks, Guy.

missing import

There is an import in view_decorators.py from a file that is not in the code:

from framework.utils import partial

what's that?

Thanks!

Unicode error

It happens when I try to login/register using your example, maybe because my django settings are in portuguese:

Unicode error hint
The string that could not be encoded/decoded was: ndere��o de


Environment:


Request Method: GET
Request URL: http://mysite.com/facebook/connect/?facebook_login=1

Django Version: 1.3.1
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'anuncio',
 'django_facebook',
 'south',
 'registration']
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 "/home/kiler6/mysite.com/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/kiler6/mysite.com/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/views/decorators/csrf.py" in wrapped_view
  39.         resp = view_func(*args, **kwargs)
File "/home/kiler6/mysite.com/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/views/decorators/csrf.py" in wrapped_view
  52.         return view_func(*args, **kwargs)
File "/home/kiler6/mysite.com/env/lib/python2.5/site-packages/django_facebook/views.py" in connect
  87.                         'with error %s' % e

Exception Type: UnicodeDecodeError at /facebook/connect/
Exception Value: 'ascii' codec can't decode byte 0xc3 in position 3557: ordinal not in range(128)

Please consider changing the license

Hi Thierry,

Would you mind changing the license to more permissive one (MIT, BSD, Apache)?

You can certainly choose any license you want but it'll be nice to have the best implementation of facebook-django integration available to wider audience, GPL is very limiting.

URL redirection issues with the next input field

I am trying to use the next input field, as suggested in the django-facebook documentation. But after successful login, I keep getting redirected to root page of my site.

[...]
input type="hidden" value="{{ request.path }}" name="next"
[...]

I found that in the next_redirect function in utils.py, the following line was returning nothing, despite the fact that I specify the next input filed in my login form. As a result, I am getting redirected to the default page '/'

redirect_url = request.REQUEST.get(key)

When I view the source for http://www.fashiolista.com/, I see that you're using the next field to redirect users to the right page after registration/login.

Are there any caveats to using the next field for redirection? And a more general question would be, is there a way to specify a django context variable (and its value) from within a template (as opposed to a view)?

Thanks!

csrf_exempt for connect view

Hi,

i'm trying django-facebook and i got a CSRF verification failed. Request aborted.

So i think that the connect function needs csrf_exempt decorator.

Odd authentication behaviour on my site and fasionlista

I have moved to 3.2.7 and including the js to enable oauth2 (oauth: true in the FB.init params) and the new facebook.js now looks for response instead of session to be returned. I then login via the js SDK using onclick="F.connect(this.parentNode);" I get the fb login popup and login fine.

If I then click over to another tab in the same browser session and go directly into facebook I get inot facebook fine but then immediately get a popup in facebook: Not Logged In - Please login to continue. It is as if going into facebook is logging me out.

If I don't click over to a facebook tab the session in my site seems to be ok.

If I login to facebook first then click over to a tab containing my site and connect with facebook my original facebook session remains logged in ok.

All of the above is true for fashionsta too.

Is this expected behaviour? I am sure prior to 3.2.7 and oauth2 I could switch between facebook and own site tabs without reauthenticating?

Guy.

staticURL is not defiend

Latest commit, facebook.js
firebug staticUrl is not defined.
Maybe this file is supposed to be rendered by django, and this was meant to be {{ staticurl }}

URL matching settings from Facebook

Another common issue are the url matching settings from Facebook. Facebook requires you to fill in a domain for your application. In order for things to work with local development you need to use the same domain. So if you production site is www.mellowmorning.com you should run your development server on something like local.mellowmorning.com in order for facebook to allow authentication.

You warned clearly for this, and i do understand this. But I am developing on localhost , and now Facebook even asks for SSL.

What can i do ? Can you explain how to solve this situation ? I have seen other issues here but i couldn't understand how to do it. I need something more step-by-step. It's my first time using django-facebook and i really wanted to use this library.

Thanks in advance,

KeyError at /facebook/connect/

I just tried using django-facebook by following your installation instructions (which are excellent, btw). After updating my models, I tried to test the registration flow at /facebook/connect and hit the following error after entering my FB credentials. Any idea what I might be doing wrong?

KeyError at /facebook/connect/
'email'
Request Method: GET
Request URL: http://jarayo.com/social/facebook/connect/?facebook_login=1&attempt=1&code=AQAzePBu-J54rOqDJkGRj-2nROAJKJBStEobz5QsOITch2lsR4OcYQukBCz5W_uxusr2XBBMrOVmgV7Adsg8Ge58fbllzxFmHKJZ9p12MDOKuuixZ6ChqbjfPaZ-6ShKAhtlM0McMJA2IIJivGq5ddvWl9KqcsR8YVGKWY9nRPiMnCdc6gjSp0sW8X70oCiQnUI
Django Version: 1.2.1
Exception Type: KeyError
Exception Value:
'email'
Exception Location: /usr/local/www/jarayo/social/pinax/apps/account/auth_backends.py in authenticate, line 12
Python Executable: /usr/bin/python
Python Version: 2.6.6
Server time: Thu, 17 Nov 2011 23:59:35 -0500
Traceback Switch to copy-and-paste view

/usr/local/www/jarayo/social-env/lib/python2.6/site-packages/django/core/handlers/base.py in get_response
response = callback(request, _callback_args, *_callback_kwargs) ...
▶ Local vars
/usr/local/www/jarayo/social-env/lib/python2.6/site-packages/django/views/decorators/csrf.py in wrapped_view
resp = view_func(_args, *_kwargs) ...
▶ Local vars
/usr/local/www/jarayo/social-env/lib/python2.6/site-packages/django/views/decorators/csrf.py in wrapped_view
return view_func(_args, *_kwargs) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django_facebook/views.py in connect
action, user = connect_user(request) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django_facebook/connect.py in connect_user
auth_user = authenticate(facebook_id=facebook_data['id'], **kwargs) ...
▶ Local vars
/usr/local/www/jarayo/social-env/lib/python2.6/site-packages/django/contrib/auth/init.py in authenticate
user = backend.authenticate(**credentials) ...
▶ Local vars
/usr/local/www/jarayo/social/pinax/apps/account/auth_backends.py in authenticate
lookup_params["email"] = credentials["email"] ...
▶ Local vars

An error occurred with DjangoFBTest.

I am getting errors when running the example app. If I am already logged into facebook, the window that pops up gives the error message: "An error occurred with DjangoFBTest. Please try again later." If I am not logged in, at the top of the facebook form there is an invalid url error: "Given URL is not allowed by the Application configuration." When I submit the form I still get the first generic error.

A similar problem was posted at http://www.mellowmorning.com/2010/05/17/django-facebook-open-graph-api-implementation/. i tried the second suggestion given in the response (setting status to true) but it did not help. How would I implement the other suggestion, the FB.getLoginStatus call, or any other fix to this problem?

The first error happens frequently on my own app. It usually happens when the user is already registered and is logged into facebook and attempting to login to the site. Sometimes i get the error message but it logs me in correctly.

Thanks!

Facebook is not giving us the permissions needed

Hello,

I am running a Django app. I included django_facebook and made all the necessary configurations (variables in settings.py file, setting up Facebook app).

However, when I use the Sign In with Facebook button on the sample page, I get the following error:

ValueError at /facebook/connect/
Somehow facebook is not giving us the permissions needed, lets break instead of endless redirects. Fb was <open_facebook.api.OpenFacebook object at 0x7fb8b5458b90> and permissions {}

(...)

Exception Value:
Somehow facebook is not giving us the permissions needed, lets break instead of endless redirects. Fb was <open_facebook.api.OpenFacebook object at 0x7fb8b5458b90> and permissions {}
Exception Location: /home/chingchong/lib/python2.7/django_facebook/utils.py in test_permissions, line 38
Python Executable: /usr/local/bin/python
Python Version: 2.7.1

Should not create usernames too long for contrib.auth

I ran into an issue where a certain facebook user was getting an error trying to connect. Turns out, the username generated in FacebookUserConverter was longer then 30 characters. Both registration and contrib.auth get unhappy when this happens.

ValueError at /facebook/connect/

Hi,

I am a newbie in Django and I am trying your plugin. I setup the APP ID and APP secret properly but I got this error when I try to click the sign in button in http://localhost:8000/facebook/connect:

"Facebook checks the domain name of your apps. Therefor you cannot run on localhost. Instead you should use something like local.fashiolista.com. Replace Fashiolista with your own domain name."

Does that mean I cannot deploy my code in my local machine? If I am wrong, can you tell me how to overcome my issue?

Thanks,
Kahou

can't authenticate with fb

Hi,

i' m not able to authenticate my user in connect():

I'm logged in fb, i have email and verified set but this line fails:

authenticated_user = authenticate(facebook_id=profile['id'], **kwargs)

The django docs says that username and password must be passed in order to be authenticated. It also says that is possible to use other backends for authentication, are we using somehting provided in django-registration? do you have any pointer to relevant documentation?

Unicode error

Hi i just stumble upon a unicode error, i traced it to the connect.py line 166
error = facebook_exceptions.IncompleteProfileError('Facebook data %s '
'gave error %s' % (facebook_data, form.errors))

My forms return errors with unicode characters 'ñ ó á' so i was getting unicode exception, all i had to was add a little u in front of the string
error = facebook_exceptions.IncompleteProfileError(u'Facebook data %s '
'gave error %s' % (facebook_data, form.errors))
And the form returns the strings correctly now.
Oh and i added # encoding: UTF-8 to pretty much all files that touch unicode, i'm sorry this is such a shitty contribution but i really can't look any deeper into it.

oAuth permission appear to be hard coded in view.py

Hi - I am using version 3.2.7. I have passed a reduced set of permissions to F.connect() but subsequently the view.py (line 72) tests for a hard coded scope_list = ['email','user_about_me','user_birthday','user_website'] and makes a second call to facebook to get the further permissions granted. Is there a reason for requiring this set of permissions? If I make this list either [''] or [] I get errors.

This appears to lead to a second problem, in that if a second call for enhanced permissions is made by the time post_facebook_registration is called the request no longer contains the authentication form and therefore doesn't contain the register_next key (in fact any of the routing keys) so alway rerouted to facebook/connect

I am happy to make code changes and contribute them but wanted to check my understanding is correct? Also if you have any preferred approach to changing (and you want me to do it) let me know.

Guy.

Filling in facebook data on fresh registration

Is there a particular reason why all the facebook data isn't filled in when registering for the first time?
In other words, why not call _connect_user immediately after calling _register_user ?

Removing django_registration from requirements

Hi there,

First of all thanks for this great app!

I don't use django_registration on my projects so I had to tamper with django_facebook's internal to get it working with my project.

Would you be interested in taking patches to decouple this project from django_registration if we can come up with a generic and clean way to do this?

Regards,
Selwin

About installing Django-Facebook

hi, i have installed Django-facebook. and i saw that once of the dependencies is python-cjson.

May i know which version of python-cjson did you isntall? cos i have tried the current version 1.05 and previous version 1.03 and it couldnt be installed.

Is there other way to use Django-facebook without using python-cjson?

Can't Execute fql.

Hi. tschellenbach. My name is salexkidd.

django-facebook is very nice ;)

But, I found the little bug. I can't execute FQL.
django_facebook.official_sdk._request_json() need 2 argument.
but, django_facebook.official_sdk.fql() send a one argument.

if call the fql...

fb = get_facebook_graph(request)
fql_data = fb.fql('select name, uid from user where uid=4')

we got a "TypeErrortakes exactly 2 arguments (0 given)".

Thx!

integration with userena cannot find field facebook_id

I integrated userena and django-facebook and followed the instructions, but i get an field error saying "Cannot resolve keyword 'facebook_id' into field. Choices are: id, language, mugshot, privacy, user"... How can i resolve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.