Exemple #1
0
	def on_profile_request_complete(self, person):
		"""Callback for the initial OAuth flow's call to fetch_person_by_token."""
		# We compute the time= param here to take into account potential time
		# spent during the API call.
		Cache.set(self.auth_cache_key_template  % person['id'], self.gplus_access_token,
			time=int((self.gplus_expires_at - datetime.datetime.today()).total_seconds()),
		)

		# store refresh token and gplus user id in database
		if self.gplus_refresh_token is not None:
			TokenIdMapping.update_refresh_token(person['id'], self.gplus_refresh_token)
	
		self.set_cookie('gplus_id', str(person['id']))
		self.redirect('/')