def get_token()

in wearable/main.py [0:0]


def get_token() -> str:
    # Attempt to obtain the default credentials
    credentials, project = google.auth.default(
        scopes=["https://www.googleapis.com/auth/cloud-platform"]
    )

    # Ensure credentials are valid and have a token
    if credentials.requires_scopes:
        credentials = credentials.with_scopes(
            ["https://www.googleapis.com/auth/cloud-platform"]
        )

    if credentials.valid is False:
        credentials.refresh(Request())

    return credentials.token