Provides google authorisation url :param host_url: Base url for hosting application :return: authorisation url to complete authentication
(self, host_url)
| 442 | return obj |
| 443 | |
| 444 | def get_auth_url(self, host_url): |
| 445 | """ |
| 446 | Provides google authorisation url |
| 447 | :param host_url: Base url for hosting application |
| 448 | :return: authorisation url to complete authentication |
| 449 | """ |
| 450 | auth_url = None |
| 451 | error = None |
| 452 | # reset below variable to get latest values in fresh |
| 453 | # authentication call |
| 454 | self._verification_successful = False |
| 455 | self._verification_error = None |
| 456 | try: |
| 457 | self._redirect_url = host_url + 'google/callback' |
| 458 | flow = InstalledAppFlow.from_client_config( |
| 459 | client_config=self._client_config, scopes=self._scopes, |
| 460 | redirect_uri=self._redirect_url) |
| 461 | auth_url, state = flow.authorization_url( |
| 462 | prompt='select_account', access_type='offline', |
| 463 | include_granted_scopes='true') |
| 464 | session["state"] = state |
| 465 | except Exception as e: |
| 466 | error = str(e) |
| 467 | self._verification_error = error |
| 468 | return auth_url, error |
| 469 | |
| 470 | def callback(self, flask_request): |
| 471 | """ |
no outgoing calls
no test coverage detected