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/' ) # this sets the background color of the master UIView (when there are no windows/tab groups on it) Ti.UI.setBackgroundColor('#000') # create tab group tabGroup = Ti.UI.createTabGroup() # create base UI tab and root window win1 = Ti.UI.createWindow( title: 'eZ.REST Auth' backgroundColor: '#fff' ) tab1 = Ti.UI.createTab( icon: 'KS_nav_views.png' title: 'Auth' window: win1 ) # create controls tab and root window 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 = ( e ) -> Ti.API.info( 'SUCCESS!!!!!!einself!!' ) Ti.API.info( 'Token valid for ' + e.source.parent_obj.expiry_time + ' seconds.' ) tabGroup.setActiveTab( 1 ) oa.getNodeList( 2, -> Ti.API.info( 'Successful response! (' + this.responseText + ')' ) ) cancel_function = ( e ) -> Ti.API.info( 'CANCELLED!!!!!!einself!!' ) win1.add( oa.getAuthView( success_function, cancel_function ) ) # add tabs tabGroup.addTab( tab1 ) tabGroup.addTab( tab2 ) # open tab group tabGroup.open()