Cloud Connected

"I have been searching for a product like Cloud CMS for over 10 years.

After false starts with some typical content management solutions, we were finally able to design the content repository that our business required."
James Baddiley
James Baddiley, CEO

Cloud CMS - The Content Platform for Your Sencha Touch Applications

If you are a Sencha developer and need a CMS for your project, Cloud CMS can be an ideal cloud based content platform that you are looking for.

This blog provides details about how you can easily plug Cloud CMS into your new or existing Sencha Touch applications.

To build a Sencha Touch application that uses Cloud CMS as its content platform, all you need to do is to take a few simple steps:

Step 1 : Sign up with Cloud CMS

Cloud CMS offers a free sandbox account that you can use to play around with Cloud CMS at no cost. For the purposes of this guide, we’ll use this free sandbox account to connect and work with the APIs.

On the other hand, for your own private projects, you’ll want to first sign up with Cloud CMS for a free trial or a subscription account. If you have already signed up, then you can just substitute your own account details in the appropriate places.

Since Cloud CMS supports OAuth2 for platform authorization, you will need both client credential and user credential for your application.

To locate your client credential, sign in your Cloud CMS console and browse to Clients page and then select a client for authentication. From client dashboard page, you will find its key/secret pair.

For user credential, you can either use its username/password pair or any authentication grant that you have setup for that user.

Step 2 : Download Cloud CMS JavaScript driver

Cloud CMS JavaScript driver handles all HTTP/HTTPS calls, data conversions, OAuth2 authorization handshakes and any and all interaction with the Cloud CMS platform in a secure manner.

To get the latest version of the driver, you can visit its hosting site and download either its minified version or uncompressed version.

Step 3 : Setup web server proxy

If we want to run our Cloud CMS powered Sancha Touch app as a pure HTML5/JavaScript application, we will need to place it under a web server such as Apache web server.

Due to the cross domain limitation of ajax calls, we will need to setup a reverse proxy that forwards HTTP/HTTPS request “/proxy/*” to “*”.

Here is a sample Apache configuration file (replace server name, server alias and other
directories with your own settings).

<VirtualHost *:80>



RewriteEngine On
RewriteRule .* - [E=host:%{HTTP_HOST}]

ProxyRequests Off

ProxyPassInterpolateEnv On
ProxyPass /proxy interpolate
ProxyPassReverse /proxy interpolate
ProxyPassReverseCookieDomain ${host} interpolate

<Directory />
Options -Indexes
AllowOverride All


Place the above custom configuration file in your Apache conf directory and restart the
Apache server.

Step 4 : Build Cloud CMS powered Sencha Touch applications

Let us first build a simple Hello World application (click here to download the full project).

1) If you haven’t already installed Sencha Touch, we recommend you visit Sencha’s web site to download their framework and check out their documentation.

2) Follow instructions in Sencha Touch’s Getting Started Guide to setup a simple “Getting Started” application.

3) Create a cloudcms sub directory under the project root directory and then place the Cloud CMS JavaScript driver under it.

4) Edit app.json (which is under root directory) and add the Cloud CMS JavaScript Driver to the list of JavaScript assets.

    "js": [
            "path": "sdk/sencha-touch.js"
            "path": "app.js",
            "bundle": true, 
            "update": "delta"
            "path": "cloudcms/gitana.js"

5) Edit Main.js ( which is under app/view directory). Register a custom listener and add the code for connecting to Cloud CMS using the provided credentials. Once the connection is made, it will then print out a Hello World message with the name of the authenticated user.

Ext.define("GS.view.Main", {
    config: {

        listeners: {
            activate: 'onActivate'


    onActivate: function(me, container) {
        new Gitana({
            "clientId" : "676e3450-6131-46c2-99cc-496aa2ad80fa",
            "clientSecret" : "......"
            "username" : "demo",
            "password" : "demo"
        }).then(function() {
            var authInfo = this.getDriver().getAuthInfo();
            var name = authInfo.getPrincipalName();
            me.innerItems[0].setHtml('Hello ' + name + '! Welcome to Cloud CMS!');

6) Open the application with your browser (Safari or Chrome) and we should have a screen which looks like this.

All source code of the examples can be downloaded from

GitHub Project for Cloud CMS Sencha Examples

To learn more about using Cloud CMS JavaScript driver, you can also check out our documentation site and hosted online samples.

Share this post

comments powered by Disqus