The invention discloses a method of a home terminal to access message middleware based on the MQTT protocol, and relates to the technical field of the Internet of Things. The method comprises the following steps: S1, importing home terminal information; S2, requesting, by the home terminal, an authentication service platform, and performing calculation encryption to obtain a check code; S3, sending, by the home terminal, the check code to the authentication service platform for comparison and verification, and returning a security token if the check code is consistent; S4, requesting, by the home terminal carrying the security token, the authentication service platform to obtain the message middleware connection information; and S5, accessing, by the home terminal, the message middleware,and calling, by the message middleware, an authentication service platform interface to perform client identity authentication. According to the method, the authentication information of the message middleware and the device is separated, which is beneficial for the enterprise to perform unify and centralize the device access information and the security token information of the message middleware, thereby reducing the pressure of the message middleware server because of the batch access authentication, and greatly improving the system performance and the security.