Error in callback from acs with Alloy

You must Login before you can answer or comment on any questions.

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']();
    }

— asked 2 years ago by Antonio Sandoval
3 Comments
  • I'm having same issue. Logs show that ACS received/processed/returned the data but app not doing anything with response. Thread here

    — commented 2 years ago by Ryan Gartin

  • Are you working with Alloy too?

    — commented 2 years ago by Antonio Sandoval

  • Negative.

    — commented 2 years ago by Ryan Gartin

2 Answers

I change the SDK version to 2.3 and it worked

— answered 2 years ago by Antonio Sandoval
answer permalink
6 Comments
  • Interesting...pumping down to 2.1.4 didn't fix it. But once I bumped down to 2.1.3 it works. But as soon as I go back to 3.0 it breaks. Who can submit a bug report on this?

    — commented 2 years ago by Ryan Gartin

  • Reported: https://jira.appcelerator.org/browse/TC-1670

    — commented 2 years ago by Antonio Sandoval

  • Fixed in latest SDK, 3.0.2. Thanks Appcelerator team!

    — commented 2 years ago by Ryan Gartin

  • Show 3 more comments

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!