To make this sample run you will need to populate the client_secrets.json file found at:
%s
.
with information found on the APIs Console.
""" % CLIENT_SECRETS http = httplib2.Http(memcache) service = discovery.build("plus", "v1", http=http) decorator = appengine.oauth2decorator_from_clientsecrets( CLIENT_SECRETS, scope='https://www.googleapis.com/auth/plus.me', message=MISSING_CLIENT_SECRETS_MESSAGE) class MainHandler(webapp2.RequestHandler): @decorator.oauth_aware def get(self): variables = { 'url': decorator.authorize_url(), 'has_credentials': decorator.has_credentials() } template = JINJA_ENVIRONMENT.get_template('grant.html') self.response.write(template.render(variables)) class AboutHandler(webapp2.RequestHandler): @decorator.oauth_required def get(self): try: http = decorator.http() user = service.people().get(userId='me').execute(http=http) text = 'Hello, %s!' % user['displayName'] template = JINJA_ENVIRONMENT.get_template('welcome.html') self.response.write(template.render({'text': text })) except client.AccessTokenRefreshError: self.redirect('/') app = webapp2.WSGIApplication( [ ('/', MainHandler), ('/about', AboutHandler), (decorator.callback_path, decorator.callback_handler()), ], debug=True)