I’m working in an app that has a log in and a home screen.I'm using acs to log in. . On Android, problem is on the response from acs for authentication, no matter it’s an error or a success, callback isn't working.
On iOS, ACS callback is working OK.
Titanium SDK: 3.0.0.GA
lib/cloud.js
var Cloud = require('ti.cloud'); Cloud.debug = true; exports.login = function(args){ Cloud.Users.login({ login: args.username, password: args.password }, function (e) { if (e.success) { if(args.success){args.success(e.users[0])} }else{ if(args.error){args.error(e)} } }); }controller/login.js
var cloud = require('cloud'); var user = Alloy.Models.user; $.authentication.setHandlers({ success:function(args){ cloud.login({ username : args.username, password : args.password, success: function(user){ $.login.close(); Alloy.createController('home').getView().open(); }, error: function(error){ alert(error); } }); }, error: function(){ alert('Error en los datos'); } });widgets/ti.sandtonio.authentication/controllers/login.js
var HANDLERS = ['success', 'error']; var handlers = {}; exports.setHandlers = function(args) { _.each(HANDLERS, function(h) { if (args[h]) { handlers[h] = args[h]; } }); } function submit(){ if($.username.value && $.password.value){ if(handlers['success']) handlers['success']({ username: $.username.value, password: $.password.value }); }else{ if(handlers['error']) handlers['error'](); }
2 Answers
I change the SDK version to 2.3 and it worked
In studio, go to Help and click on "Install Specific Titanium SDK". Copy and paste link for respective .zip file from this site http://builds.appcelerator.com.s3.amazonaws.com/index.html
Your Answer
Think you can help? Login to answer this question!