def authPart2(self, code):
    access_token_url = 'https://graph.facebook.com/oauth/access_token?client_id=' + self.api_key + \
                       '&redirect_uri=' + web.ctx.homedomain + '/auth/facebookAuth' + \
                       '&client_secret=' + self.api_secret + '&code=' + code

    pageGet = urllib2.urlopen(access_token_url).read()
    self.final_oauth_token = urlparse.parse_qs(pageGet)['access_token'][0]
    authDict = authPickler.getAuthDict(self.apiName)
    authDict["final_oauth_token"] = self.final_oauth_token
    authPickler.setAuthDict(self.apiName, authDict)
    self.authorised = True

    self.setupAPI()
    
    return redirectToUrlText(web.ctx.homedomain)
Esempio n. 2
0
  def authPart2(self, oauth_verifier):
    access_token = self.tumblr_oauth.get_access_token(oauth_verifier)

    print "Access key:", access_token.key
    print "Access Secret:", access_token.secret

    self.final_oauth_token = access_token.key
    self.final_oauth_token_secret = access_token.secret

    authDict = authPickler.getAuthDict(self.apiName)
    authDict["final_oauth_token"] = self.final_oauth_token
    authDict["final_oauth_token_secret"] = self.final_oauth_token_secret
    authPickler.setAuthDict(self.apiName, authDict)
    self.authorised = True

    self.setupAPI()

    return redirectToUrlText(web.ctx.homedomain)
Esempio n. 3
0
  def authPart2(self, oauth_token, oauth_verifier):
    f = FlickrAPI(api_key=self.api_key,
        api_secret=self.api_secret,
        oauth_token=self.oauth_token,
        oauth_token_secret=self.oauth_token_secret)

    authorised_tokens = f.get_auth_tokens(oauth_verifier)

    self.final_oauth_token = authorised_tokens['oauth_token']
    self.final_oauth_token_secret = authorised_tokens['oauth_token_secret']

    authDict = authPickler.getAuthDict(self.apiName)
    authDict["final_oauth_token"] = self.final_oauth_token
    authDict["final_oauth_token_secret"] = self.final_oauth_token_secret
    authPickler.setAuthDict(self.apiName, authDict)
    self.authorised = True

    self.setupAPI()

    return redirectToUrlText(web.ctx.homedomain)
  def authPart2(self, oauth_token, oauth_verifier):
    token = oauth.Token(self.oauth_token, self.oauth_token_secret)
    token.set_verifier(oauth_verifier)

    oauth_consumer             = oauth.Consumer(key=self.api_key, secret=self.api_secret)
    
    oauth_client  = oauth.Client(oauth_consumer, token)
    resp, content = oauth_client.request(twitter.ACCESS_TOKEN_URL, method='POST', body='oauth_callback=oob&oauth_verifier=%s' % oauth_verifier)
    access_token  = dict(parse_qsl(content))
    
    self.final_oauth_token = access_token['oauth_token']
    self.final_oauth_token_secret = access_token['oauth_token_secret']

    authDict = authPickler.getAuthDict(self.apiName)
    authDict["final_oauth_token"] = self.final_oauth_token
    authDict["final_oauth_token_secret"] = self.final_oauth_token_secret
    authPickler.setAuthDict(self.apiName, authDict)
    self.authorised = True

    self.setupAPI()

    return redirectToUrlText(web.ctx.homedomain)