MCPcopy Create free account
hub / github.com/EasyIME/PIME / get

Method get

python/python3/tornado/test/auth_test.py:537–557  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

535
536 @gen.coroutine
537 def get(self):
538 code = self.get_argument("code", None)
539 if code is not None:
540 # retrieve authenticate google user
541 access = yield self.get_authenticated_user(self._OAUTH_REDIRECT_URI, code)
542 user = yield self.oauth2_request(
543 self.test.get_url("/google/oauth2/userinfo"),
544 access_token=access["access_token"],
545 )
546 # return the user and access token as json
547 user["access_token"] = access["access_token"]
548 self.write(user)
549 else:
550 self.authorize_redirect(
551 redirect_uri=self._OAUTH_REDIRECT_URI,
552 client_id=self.settings["google_oauth"]["key"],
553 client_secret=self.settings["google_oauth"]["secret"],
554 scope=["profile", "email"],
555 response_type="code",
556 extra_params={"prompt": "select_account"},
557 )
558
559
560class GoogleOAuth2AuthorizeHandler(RequestHandler):

Callers

nothing calls this directly

Calls 6

get_argumentMethod · 0.80
oauth2_requestMethod · 0.80
get_urlMethod · 0.45
writeMethod · 0.45
authorize_redirectMethod · 0.45

Tested by

no test coverage detected