EvilLinux, Late replies are great! ;-)
2014-07-23 4:34 GMT+02:00 EvilLinux <evilli...@gmail.com>: > Hi Michele, > > Sorry for a very late reply but I just wanted to say thank you very much > as this solved my issue. I decided to pick this project up again earlier > today and this helped me move along to other things with it that I am > playing around to figure out. > > Thank you again, > EvilLinux > > > On Wednesday, May 14, 2014 9:02:07 AM UTC-7, Michele Comitini wrote: > >> this should be the correct way to access the user access token. >> token = auth.settings.login_form.accessToken() >> >> 2014-05-14 6:51 GMT+02:00 EvilLinux <evil...@gmail.com>: >> > Hello, >> > >> > I am hoping someone might be able to help me figure what I might be >> doing >> > wrong or what the next steps I would need to do with calling the user's >> > facebook access token. I followed the web2py book's method to obtain >> the >> > facebook login: >> > >> > ## import required modules >> > try: >> > import json >> > except ImportError: >> > from gluon.contrib import simplejson as json >> > from facebook import GraphAPI, GraphAPIError >> > from gluon.contrib.login_methods.oauth20_account import OAuthAccount >> > >> > >> > ## extend the OAUthAccount class >> > 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): >> > OAuthAccount.__init__(self, None, FB_CLIENT_ID, >> FB_CLIENT_SECRET, >> > self.AUTH_URL, self.TOKEN_URL, >> > scope='email, publish_actions', >> > state="auth_provider=facebook", >> > display='popup') >> > 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: >> > session.token = None >> > self.graph = None >> > >> > if user: >> > if not user.has_key('username'): >> > username = user['id'] >> > else: >> > username = user['username'] >> > >> > if not user.has_key('email'): >> > email = '%s.fakemail' %(user['id']) >> > else: >> > email = user['email'] >> > >> > return dict(first_name = user['first_name'], >> > last_name = user['last_name'], >> > username = username, >> > email = '%s' %(email) ) >> > >> > ## use the above class to build a new login form >> > auth.settings.login_form=FaceBookAccount() >> > >> > So I am able to successfully login and log out without any issues with >> the >> > system which is great. The problem I am running into is I do not >> understand >> > where it stores and/or how to access the user's FB token so I am able >> to >> > allow them to click a link or submit a form and have it posted to their >> > wall. >> > >> > I looked through the examples of the facebook-sdk: >> > https://github.com/pythonforfacebook/facebook-sdk and it seems really >> simple >> > that I would just need to do what the front page says. I am able to do >> that >> > if I go a hardcode an access token in which I do not believe is the >> proper >> > method when you want to have different users be able to post to their >> own >> > walls correct? >> > >> > Thank you in advance for any direction or sample code that may be >> provided I >> > greatly appreciate it. >> > >> > -- >> > 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+un...@googlegroups.com. >> > For more options, visit https://groups.google.com/d/optout. >> > -- > 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. > -- 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.