A server comprising: a wireless communication circuit; a memory; and a processor electrically connected to the memory and the wireless communication circuit; wherein the processor is configured to: receive, from a first electronic device associated with a first user account, sharing setting information for controlling one or more Internet-of-Things, IoT, devices of a group through the wireless communication circuit, wherein the sharing setting information includes the first user account and group information of the one or more IoT devices of the group, provide, based on receiving the sharing setting information, a quick response, QR, code to the first electronic device through the wireless communication circuit, such that the QR code is output on a display of the first electronic device, share, based on a second electronic device associated with a second user account having recognized the QR code output on the display of the first electronic device, information about the QR code with the second electronic device, wherein the information about the QR code includes the sharing setting information, store, based on identifying the second user account, the group information of the one or more IoT devices of the group in the memory in association with the second user account, based on the stored group information, allow the second electronic device to control the one or more IoT devices of the group. a wireless communication circuit; a memory; and a processor electrically connected to the memory and the wireless communication circuit; wherein the processor is configured to: receive, from a first electronic device associated with a first user account, sharing setting information for controlling one or more Internet-of-Things, IoT, devices of a group through the wireless communication circuit, wherein the sharing setting information includes the first user account and group information of the one or more IoT devices of the group, provide, based on receiving the sharing setting information, a quick response, QR, code to the first electronic device through the wireless communication circuit, such that the QR code is output on a display of the first electronic device, share, based on a second electronic device associated with a second user account having recognized the QR code output on the display of the first electronic device, information about the QR code with the second electronic device, wherein the information about the QR code includes the sharing setting information, store, based on identifying the second user account, the group information of the one or more IoT devices of the group in the memory in association with the second user account, based on the stored group information, allow the second electronic device to control the one or more IoT devices of the group. receive, from a first electronic device associated with a first user account, sharing setting information for controlling one or more Internet-of-Things, IoT, devices of a group through the wireless communication circuit, wherein the sharing setting information includes the first user account and group information of the one or more IoT devices of the group, provide, based on receiving the sharing setting information, a quick response, QR, code to the first electronic device through the wireless communication circuit, such that the QR code is output on a display of the first electronic device, share, based on a second electronic device associated with a second user account having recognized the QR code output on the display of the first electronic device, information about the QR code with the second electronic device, wherein the information about the QR code includes the sharing setting information, store, based on identifying the second user account, the group information of the one or more IoT devices of the group in the memory in association with the second user account, based on the stored group information, allow the second electronic device to control the one or more IoT devices of the group.