Hi Hassan,

I think we can help you, do not despair!

Ok I need some more info on your code.
What did you write in controller/default.py and in your view?

mic


Il 16 marzo 2012 17:31, Hassan Alnatour <[email protected]> ha scritto:
> Dear ALL ,
>
> I Got the new cookbook and i am having some problems , its now
> working , here is what i did :
>
> 1 - i created an application on facebook and added a Site Domain >
> test.i3zif.com  and Site URL >http://www.test.i3zif.com/
> hellofacebook .
>
> 2 - i created and file named it fbappauth.py and added my app id and
> the secret id  in the modules Folder .
>
> 3- i downloaded the python SDK from github and included the file
> FaceBook.py in  my modules.
>
> 4 - added this code in bottom of  db.py file :
>
> #########################################
> ## use fb auth
> ## for facebook "graphbook" application
> #########################################
> import sys, os
> from fbappauth import CLIENT_ID,CLIENT_SECRET
> from facebook import GraphAPI, GraphAPIError
> from gluon.contrib.login_methods.oauth20_account import OAuthAccount
>
> class FaceBookAccount(OAuthAccount):
>    """OAuth impl for FaceBook"""
>    AUTH_URL="https://graph.facebook.com/oauth/authorize";
>    TOKEN_URL="https://graph.facebook.com/oauth/access_token";
>    def __init__(self, g):
>        OAuthAccount.__init__(self, g, CLIENT_ID, CLIENT_SECRET,
>        self.AUTH_URL, self.TOKEN_URL,
>        scope='user_photos,friends_photos')
>        self.graph = None
>    def get_user(self):
>        '''Returns the user using the Graph API.'''
>        if not self.accessToken():
>            return None
>        if not self.graph:
>            self.graph = GraphAPI((self.accessToken()))
>            user = None
>        try:
>            user = self.graph.get_object("me")
>
>        except GraphAPIError, e:
>            self.session.token = None
>            self.graph = None
>        if user:
>            return dict(first_name = user['first_name'],last_name =
> user['last_name'],username = user['id'])
>
>
> auth.settings.actions_disabled =
> ['register','change_password','request_reset_password','profile']
> auth.settings.login_form=FaceBookAccount(globals())
> auth.settings.login_next=URL(f='index')
>
>
> 4 - uploaded the application to my server , then i opened "http://
> www.test.i3zif.com/hellofacebook ."  and there was nothing and then i
> pressed login and  it gave me this massage :
>
>               invalid function (default/oauth)
>
>
> What is wrong guys  ..  hope someone can help me ..
>
> Best Regards ,
> Hassan Alnatour

Reply via email to