Internet of Things (IoT) plays a prominent role in health-care of patients, which assist the physicians and patients through the assistance in effective decision-making and additionally, in the medical field, IoT plays a significant role in real-time monitoring of the patients. Even though the data provided by the IoT devices ensure the effective decision-making, the data is susceptible to the network attacks. Thus, the paper proposes an authentication protocol for enabling the secure data transmission in IoT based on three functions, such as encryption function, hashing function, and adaptive XOR function. The proposed authentication protocol is named as, Adaptive XOR, hashing and Encryption Key Exchange (AXHE) protocol, which is the combination of the functions, such as encryption function, hashing function, and adaptive XOR function. The protocol ensures the security in the communication through two successive phases, such as registration and authentication of the user, where the user name, password, public keys, private keys, and security factor are employed. The authentication is progressed as seven levels and whenever the security factor matches, the user is authenticated and the communication continues. The analysis of the proposed AXHE is performed using 50 and 100 nodes in the presence of DOS and black hole attacks, which acquires the detection rate, throughput, and detection delay of 0.3859, 0.32, and 6.535 s, respectively.