protected function initHttpClient()
    {

        // Middleware
        $obj_stack = HandlerStack::create();
        $obj_stack->push(ApplicationDefaultCredentials::getMiddleware(['https://www.googleapis.com/auth/datastore']));

        $str_base_url = self::DEFAULT_BASE_URL;

        if (getenv("DATASTORE_EMULATOR_HOST") !== FALSE) {
            $str_base_url = getenv("DATASTORE_EMULATOR_HOST");
        }

        // Create the HTTP client
        return new Client([
            'handler' => $obj_stack,
            'base_url' => $str_base_url,
            'auth' => 'google_auth'  // authorize all requests
        ]);
    }