var cancel_function, label2, oa, success_function, tab1, tab2, tabGroup, win1, win2; Ti.API.info('▶▶▶ main.coffee'); Ti.include('lib/EzOAuth2.js'); oa = new EzOAuth2('http://london2011.ez.no', '98896cbfaa12dfba67ccdc18352a6374', '20667fe88eaace9d86ad19e48c772490', 'http://oauth.extranet.silversolutions.de/ssl/oauth/'); Ti.UI.setBackgroundColor('#000'); tabGroup = Ti.UI.createTabGroup(); win1 = Ti.UI.createWindow({ title: 'eZ.REST Auth', backgroundColor: '#fff' }); tab1 = Ti.UI.createTab({ icon: 'KS_nav_views.png', title: 'Auth', window: win1 }); win2 = Ti.UI.createWindow({ title: 'eZ.REST Data', backgroundColor: '#fff' }); tab2 = Ti.UI.createTab({ icon: 'KS_nav_ui.png', title: 'Data', window: win2 }); label2 = Ti.UI.createLabel({ color: '#999', text: 'I am Window 2', font: { fontSize: 20, fontFamily: 'Helvetica Neue' }, textAlign: 'center', width: 'auto' }); win2.add(label2); success_function = function(e) { Ti.API.info('SUCCESS!!!!!!einself!!'); Ti.API.info('Token valid for ' + e.source.parent_obj.expiry_time + ' seconds.'); tabGroup.setActiveTab(1); return oa.getNodeList(2, function() { return Ti.API.info('Successful response! (' + this.responseText + ')'); }); }; cancel_function = function(e) { return Ti.API.info('CANCELLED!!!!!!einself!!'); }; win1.add(oa.getAuthView(success_function, cancel_function)); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.open();