INNER CODE UNIT · Python

_authenticate

Squarespace/datasheets · datasheets/client.py:83

    def _authenticate(self):
        if self.is_service:
            self.credentials = self._get_service_credentials()
        else:
            self.credentials = self._retrieve_client_credentials()

    def _refresh_token_if_needed(self):
        if not self.is_service or self.credentials.expired:
            self.credentials.refresh(Request())

    def _retrieve_client_credentials(self):
        """Get valid user credentials

        If storage=True, then first look in ``$DATASHEETS_CREDENTIALS_PATH``
        (default: ``~/.datasheets/client_credentials.json``) to see if authorized credentials have
        been stored. The client credentials are basically an access token that expires. If nothing
        has been stored or if the stored credentials are invalid, the OAuth2 flow is completed to
        obtain new credentials using the client secrets as the means of verifying that the user

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…