MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / callback

Method callback

web/pgadmin/misc/cloud/google/__init__.py:470–496  ·  view source on GitHub ↗

Callback function on completion of google authorisation request :param flask_request: :return: Success or error message

(self, flask_request)

Source from the content-addressed store, hash-verified

468 return auth_url, error
469
470 def callback(self, flask_request):
471 """
472 Callback function on completion of google authorisation request
473 :param flask_request:
474 :return: Success or error message
475 """
476 try:
477 authorization_response = flask_request.url
478 if session['state'] != flask_request.args.get('state', None):
479 self._verification_successful = False,
480 self._verification_error = 'Invalid state parameter'
481 flow = InstalledAppFlow.from_client_config(
482 client_config=self._client_config, scopes=self._scopes,
483 redirect_uri=self._redirect_url)
484 flow.fetch_token(authorization_response=authorization_response)
485 self._credentials = flow.credentials
486 self.credentials_json = \
487 self._credentials_to_dict(self._credentials)
488 self._verification_successful = True
489 return 'The authentication flow has completed. ' \
490 'This window will be closed.'
491 except AccessDeniedError as er:
492 self._verification_successful = False
493 self._verification_error = er.error
494 if self._verification_error == 'access_denied':
495 self._verification_error = 'Access denied.'
496 return self._verification_error
497
498 @staticmethod
499 def _credentials_to_dict(credentials):

Callers 10

getPgMenuItemFunction · 0.45
dispatchFunction · 0.45
getPgMenuItemFunction · 0.45
fireEventMethod · 0.45
_getListenerDataMethod · 0.45
signalMethod · 0.45
ToolbarButtonFunction · 0.45
refactorMenuItemsFunction · 0.45
callbackFunction · 0.45
WorkspaceButtonFunction · 0.45

Calls 2

_credentials_to_dictMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected