def handleAuthCallBack(self, code, user_id): oauth_verifier = self.get_argument("oauth_verifier", None) oauth_token = self.get_argument("oauth_token", None) auth_session_id = self.get_secure_cookie("auth-session-id", None) oauth_token_secret = secrets[auth_session_id] # Clear cookies and dictionary self.clear_cookie("auth-session-id") secrets.pop(auth_session_id, None) # Request access token token = oauth.Token(oauth_token, oauth_token_secret) token.set_verifier(oauth_verifier) self.client = oauth.Client(self.consumer, token) resp, content = self.client.request(self.access_token_url, "POST") access_token = urllib.parse.parse_qs(content.decode()) yield save_token( provider="tumblr", user_id=user_id, token_data={ "access_token": access_token["oauth_token"][0], "access_token_secret": access_token["oauth_token_secret"][0], }, )
def handleAuthCallBack(self, code, user_id): oauth_verifier = self.get_argument('oauth_verifier', None) oauth_token = self.get_argument('oauth_token', None) auth_session_id = self.get_secure_cookie("auth-session-id", None) oauth_token_secret = secrets[auth_session_id] # Clear cookies and dictionary self.clear_cookie("auth-session-id") secrets.pop(auth_session_id, None) # Request access token token = oauth.Token(oauth_token, oauth_token_secret) token.set_verifier(oauth_verifier) self.client = oauth.Client(self.consumer, token) resp, content = self.client.request(self.access_token_url, "POST") access_token = urllib.parse.parse_qs(content.decode()) yield save_token(provider="tumblr", user_id=user_id, token_data={ "access_token": access_token['oauth_token'][0], "access_token_secret": access_token['oauth_token_secret'][0] })
def handleAuthCallBack(self, code, user_id): redir_uri = "{0}/auth/google".format( self.application.settings['base_url']) access = yield self.get_authenticated_user( redirect_uri=redir_uri, code=code ) # Set Cookie, Eventually (change cookie_secret) creds = client.OAuth2Credentials( access_token=access['access_token'], client_id=self.application.settings['google_oauth']['key'], client_secret=self.application.settings['google_oauth']['secret'], refresh_token=access.get('refresh_token', None), token_uri=client.GOOGLE_TOKEN_URI, token_expiry=access.get('expires_in', None), user_agent='QS-server-agent/1.0', id_token=access.get('id_token', None) ) http = httplib2.Http() http = creds.authorize(http) yield save_token( provider='google', user_id=user_id, token_data=access, )
def handleAuthCallBack(self, code, user_id): oauth = OAuth1( self.consumer_key, self.consumer_secret, self.get_argument('oauth_token', None), verifier=self.get_argument('oauth_verifier', None) ) # Make async r = requests.post( url='https://api.twitter.com/oauth/access_token', auth=oauth ) credentials = parse_qs(r.content.decode()) access_token_key = credentials.get('oauth_token')[0] access_token_secret = credentials.get('oauth_token_secret')[0] token_data = { "access_token": access_token_key, "access_token_secret": access_token_secret, } yield save_token( provider="twitter", user_id=user_id, token_data=token_data, )
def handleAuthCallBack(self, code, user_id): access_info = self.api.exchange_code_for_access_token(code) # Confirmation & Saving token yield save_token(provider="instagram", user_id=user_id, token_data=access_info)
def handleAuthCallBack(self, code, user_id): access_info = self.reddit.get_access_information(code) self.reddit.set_access_credentials(**access_info) # save the token yield save_token(provider="reddit", user_id=user_id, token_data=access_info)
def handleAuthCallBack(self, code, user_id): redir_uri = '{0}/auth/spotify'.format( self.application.settings['base_url']) access = yield self.get_authenticated_user(redirect_uri=redir_uri, code=code) # from here use spotipy - pass it over to a scraper context yield save_token(provider="spotify", user_id=user_id, token_data=access)
def handleAuthCallBack(self, code, user_id): access_info = self.api.exchange_code_for_access_token(code) # Confirmation & Saving token yield save_token( provider="instagram", user_id = user_id, token_data=access_info )
def handleAuthCallBack(self, code, user_id): access_info = self.reddit.get_access_information(code) self.reddit.set_access_credentials(**access_info) # save the token yield save_token( provider="reddit", user_id=user_id, token_data=access_info )
def handleAuthCallBack(self, code, user_id): redir_uri = '{0}/auth/spotify'.format( self.application.settings['base_url']) access = yield self.get_authenticated_user( redirect_uri=redir_uri, code=code) # from here use spotipy - pass it over to a scraper context yield save_token( provider="spotify", user_id=user_id, token_data=access )
def handleAuthCallBack(self, code, user_id): access = yield self.get_authenticated_user( redirect_uri="{0}/auth/facebook".format( self.application.settings['base_url']), client_id=self.application.settings['facebook_oauth']['key'], client_secret=self.application.settings['facebook_oauth'] ['secret'], code=code, ) yield save_token(provider='facebook', user_id=user_id, token_data=access)
def handleAuthCallBack(self, code, user_id): access = yield self.get_authenticated_user( redirect_uri="{0}/auth/facebook".format( self.application.settings['base_url']), client_id=self.application.settings['facebook_oauth']['key'], client_secret=self.application.settings['facebook_oauth']['secret'], code=code, ) yield save_token( provider='facebook', user_id=user_id, token_data=access )
def handleAuthCallBack(self, code, user_id): oauth = OAuth1(self.consumer_key, self.consumer_secret, self.get_argument('oauth_token', None), verifier=self.get_argument('oauth_verifier', None)) # Make async r = requests.post(url='https://api.twitter.com/oauth/access_token', auth=oauth) credentials = parse_qs(r.content.decode()) access_token_key = credentials.get('oauth_token')[0] access_token_secret = credentials.get('oauth_token_secret')[0] token_data = { "access_token": access_token_key, "access_token_secret": access_token_secret, } yield save_token( provider="twitter", user_id=user_id, token_data=token_data, )
def handleAuthCallBack(self, code, user_id): redir_uri = "{0}/auth/google".format( self.application.settings['base_url']) access = yield self.get_authenticated_user(redirect_uri=redir_uri, code=code) # Set Cookie, Eventually (change cookie_secret) creds = client.OAuth2Credentials( access_token=access['access_token'], client_id=self.application.settings['google_oauth']['key'], client_secret=self.application.settings['google_oauth']['secret'], refresh_token=access.get('refresh_token', None), token_uri=client.GOOGLE_TOKEN_URI, token_expiry=access.get('expires_in', None), user_agent='QS-server-agent/1.0', id_token=access.get('id_token', None)) http = httplib2.Http() http = creds.authorize(http) yield save_token( provider='google', user_id=user_id, token_data=access, )