(self)
| 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 | |
| 560 | class GoogleOAuth2AuthorizeHandler(RequestHandler): |
nothing calls this directly
no test coverage detected