What are domain keys and how do I set them up?

WebSync Cloud Domain Keypairs are a mechanism we use to restrict access to the WebSync Cloud service. When you get a license to use WebSync Cloud a Keypair is generated for you. As shown below, you use the public key to gain access to WebSync Cloud services. By default Domain Keys allow requests originating from localhost (and some others), but if you will be making requests from a custom domain then you need to configure the Domain Key to permit this.

Here are the general steps for setting up a WebSync Cloud Domain Keypair, using it from your WebSync Client, and configuring it to work with a custom domain:

  1. You'll need a WebSync Cloud license (a trial license will work). Once you have that log into our website and then go to your account page here
  2. Scroll to the bottom and create a new WebSync Cloud Keypair by clicking "New Keypair". 
  3. Once that's done click the "Manage" button for that new keypair and you'll be taken to the management screen. 
  4. You need to add your custom domain “my.custom.domain.com” to the Configured Domains section. 
  5. In your application you have you'll need to add this line of code immediately after having created your WebSync Client: 

    client.setDomainKey(new fm.guid('{the public key of your new Keypair}'));

Now, when your client connects to WebSync Cloud it's going to use your public key. WebSync Cloud will see that the request is coming from your custom domain and let it through because you have associated that key with that domain. If you also want that key to work from localhost then in the management screen for the Keypair check the "Allow connections from localhost" box and update your settings.