ThingWorx WebSocket-based Edge MicroServer (WS EMS) and Lua Script Resource (LSR) > Authenticating and Binding
  
Authenticating and Binding
The appKey group of the configuration file is used for authentication. The WS EMS must be authenticated to connect to a ThingWorx platform instance.
An Application Key is an authentication token that is generated by the ThingWorx platform instance and that represents a specific user. The Application Key is sent along with the connection request to authenticate the WS EMS with the ThingWorx platform instance, and apply the correct permissions that are associated with the Application Key’s user account.
* 
To encrypt your Application Key before copying it to the config.json file for your WS EMS, see Encrypting Application Keys, Passwords, and Passphrases.
The Application Key is set by a simple top-level key in the JSON structure.
"appKey": "some_encrypted_application_key",
* 
The code sample above is provided for example purposes only. Copy and paste the Application Key that you generated and encrypted into the value side of "appKey": "some_encrypted_application_key".
* 
Enabling authentication is an important component of a secure configuration. For examples of secure configurations for communications between the WS EMS and the LSR, see Examples of Configuring Secure Communications between the WS EMS and an LSR . These examples are presented in order of least secure (testing purposes ONLY) to most secure (strongly recommended for production environments).
Binding
Once another device registers with the WS EMS (by sending an auto bind message), the WS EMS sends a BIND message to the ThingWorx platform instance on behalf of that device. The ThingWorx platform instance then associates the WebSocket on which WS EMS is communicating with a remote thing on the platform instance whose name or identifier matches the name or identifier sent by the WS EMS (the remote thing must have been created on the platform instance, using the RemoteThing thing template or one of its derivative templates). This association is the binding that must exist so that the platform instance can send requests to the device that is communicating through the WS EMS. For information about automatic binding and the WS EMS, refer to the section, Configuring Automatic Binding for WS EMS. For information about configuring the gateway option for automatic binding, refer to Auto-bound Gateways.