hi

trying to use gigya for logging in 

when i clicked log in or go to http://my.host/user/login?_next=/
i will be redirected to twitter/fb/etc to log in, and will be redirected 
back to my redirect_uri.

redirect_uri will have code appended to it 
(redirect_uri.mydomain/?code=blabla)
but i am not logged in. and no user will be added to auth_user

i believe code always return None in accessToken().
pointers appreciated

here's what i have in db.py

class GigyaAccount(OAuthAccount):

    """OAuth impl for gigya"""

    AUTH_URL="https://socialize.us1.gigya.com/socialize.login";

    TOKEN_URL="https://socialize.us1.gigya.com/socialize.getToken";


    def __init__(self):

        OAuthAccount.__init__(self,None , client_id, client_secret,

                              self.AUTH_URL, self.TOKEN_URL,

redirect_uri='http://redirect_uri.mydomain/', x_provider='twitter',

response_type='code',

                              )


    def get_user(self):

        '''Returns the user using the Graph API.

        '''

        if not self.accessToken():

            return None

        user = None

        try:

            
r=requests.get('https://socialize.us1.gigya.com/socialize.getUserInfo?oauth_token='+self.accessToken())

            myobj= xmltodict.parse(r.content)

            user = myobj['socialize.getUserInfoResponse']

        except e:

            self.session.token = None


        if user:

            username = user['nickname']

                

            if not user.has_key('email'):

                email = '%s.fakemail' %(user['id'])

                email = user['email']    

                email = user['email']    

            myf=open('/tmp/dalamgetuser','a')

            myf.write('dalam'+time.ctime(time.time())+'\n')

            myf.close()


            return dict(first_name = user['firstName'],

                        last_name = '',

                        username = username,

                        email = '%s' %(email) )

auth.settings.login_form=GigyaAccount()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to