Implementing authentication on the application side
Now, let's go back to our Cordova/Sencha Touch application. We need to be able to authenticate in the mobile application, receive the token, save it in the application, and use it for all future requests. We already have the login form implemented on the service side. We can utilize it in our mobile application as well.
We can easily handle this task with the InAppBrowser
Cordova plugin. This plugin provides a web browser view that displays when calling window.open()
. Let's install the plugin:
$ cordova plugin add org.apache.cordova.inappbrowser
Now, let's define the UI from where we can invoke InAppBrowser
. We can do this in app/view/Main.js
. We will create the additional Settings
tab panel:
{ title: 'Settings', iconCls: 'settings', items: [ { docked: 'top', xtype: 'titlebar', title: 'Settings' }, { xtype: 'button', id: 'loginBtn', ...