def get(self): if self.oauth_client.is_authorized(): url = ''.join([self.request.protocol, '://', self.request.host, '/']) else: url, token = self.oauth_client.fetch_for_authorize() data = RequestToken.get_or_insert(str(self.current_user), user=self.current_user, service=SERVICE) data.save_token(token) self.redirect(url)
def get(self): """Fetch for access token""" if not self.oauth_client.is_authorized(): token_key = self.get_argument("oauth_token", None) token = RequestToken.get_or_insert(str(self.current_user), user=self.current_user, service=SERVICE) if token.oauth_key == token_key: self.oauth_client.fetch_access_token(token.lookup_token()) else: self.redirect('../login') return self.redirect('/')