def post(self):
     oauth_params = get_oauth_params(self.request)
     consumer = Consumer.get_by_consumer_key(oauth_params['oauth_consumer_key'])
     signature = oauth_params['oauth_signature']
     oauth_params.pop('oauth_signature')
     oauth_params.pop('realm')
     base_string = get_base_string(oauth_params, self.request.url, 'POST')
     callback = oauth_params.get("oauth_callback", consumer.callback)
     if validate_signature(consumer, base_string, signature):
         token = Token()
         Token.create(token, consumer, callback)
         token.put()
         self.response.out.write("oauth_token=%s&oauth_token_secret=%s" % (token.token,
                                                                           token.secret))
 def post(self):
     oauth_params = get_oauth_params(self.request)
     consumer = Consumer.get_by_consumer_key(oauth_params['oauth_consumer_key'])
     signature = oauth_params['oauth_signature']
     oauth_params.pop('oauth_signature')
     oauth_params.pop('realm')
     consumer = Consumer.get_by_consumer_key(oauth_params['oauth_consumer_key'])
     token = Token.get_by_token(oauth_params['oauth_token'])
     base_string = get_base_string(oauth_params, self.request.url, 'POST')
     if validate_signature(consumer, base_string, signature, token):
         access_token = AccessToken()
         AccessToken.create(access_token, token.user, token)
         access_token.put()
         self.response.out.write("oauth_token=%s&oauth_token_secret=%s" %(access_token.token,
                                                                          access_token.secret))
 def get(self):
     oauth_token = self.request.get('oauth_token')
     token = Token.get_by_token(oauth_token)
     if token:
         path = os.path.join('views', 'login.html')
         self.response.out.write(template.render(path, {'client_token': token.token}))