With the widespread use of Internet of Things and cloud computing in smart cities, various security and privacy challenges may be encountered. The most basic problem is authentication between each application. Recently, in order to prevent counterfeiting attacks in the protocol of Amin et al.(2018), Kang et al. improved an authentication protocol for IoT-Enabled devices in a distributed cloud computing environment (2020). However, We found that the Kang et al.'s protocol still has a fatal vulnerability, that is, it is attacked by offline password guessing, and malicious users can easily obtain the master key of the control server. In this article, we extend their work to design a lightweight pseudonym identity based authentication and key agreement protocol using smart card. For illustrating the security of our protocol, we used the security protocol analysis tools of AVISPA and Scyther to prove that the protocol can defend against various existing attacks. We will further analyze the interaction between participants authentication path to ensure security protection from simulated attacks detailedly. In addition, based on the comparison of security functions and computing performance, our protocol is superior to the other two related protocols. As a result, the enhanced protocol will be efficient and secure in distributed cloud computing architecture for smart city.