Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3950] Cloud.Users.showMe returns empty data with response_json_depth

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-07-01T15:00:33.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
Reporterheedoo moon
AssigneeShak Hossain
Created2016-06-28T04:39:40.000+0000
Updated2018-04-27T08:50:28.000+0000

Description

Attachments

FileDateSize
Screen Shot 2016-06-30 at 12.22.00 AM.png2016-06-29T18:40:52.000+000059835
Screen Shot 2016-06-30 at 12.39.23 AM.png2016-06-29T18:40:52.000+000027041

Comments

  1. Sharif AbuDarda 2016-06-29

    Hello, Using the sample code provided on the ticket that you mentioned, I was able to get response successfully. I have tested both in Android and in iOS. See the attachment. Make sure your user is created in the platform and you are using cloud login in your code. This is not a valid bug.
  2. heedoo moon 2016-06-30

    Can you show me how you test code and version? Below code is what I tested and I have that user account. And this is exact error message that I see. {color:#d04437}"Argument callback was an unexpected type! Expexted: function, Received: object"{color} It looks like not taking object parameter. require('ti.cloud').Users.login({ login: 'qqq', password: 'qqqqqqq' }, function (e) { if (e.success) { var user = e.users[0]; console.log("logged in"); require('ti.cloud').Users.showMe({response_json_depth:3}, function(e) { console.log("e: " + JSON.stringify(e)); }); } else { alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e))); } });
  3. Sharif AbuDarda 2016-06-30

    Hello, I used the below code.
       var win = Ti.UI.createWindow({
       
           backgroundColor : '#fff',
       
           layout : 'vertical'
       
       });
       
       var Cloud = require("ti.cloud");
       
       Cloud.Users.login({
       
           login : 'EMAIL',
       
           password : 'PASS'
       
       }, function(e) {
       
           if (e.success) {
       
               var user = e.users[0];
       
               alert('Success:\n' + 'id: ' + user.id + '\n' + 'sessionId: ' + Cloud.sessionId + '\n' + 'first name: ' + user.first_name + '\n' + 'last name: ' + user.last_name);
       
           } else {
       
               alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
       
           }
       
       });
       
       // Create a Button.
       
       var SHOW_ME = Ti.UI.createButton({
       
           title : 'SHOW_ME',
       
           height : Ti.UI.SIZE,
       
           width : Ti.UI.SIZE,
       
           top : 20,
       
       });
       
       // Add to the parent view.
       
       win.add(SHOW_ME);
       
       function show_me() {
       
           Cloud.Users.showMe(function(e) { response_json_depth:2
       
               if (e.success) {
       
                   var user = e.users[0];
       
                   alert('Success:\n' + 'id: ' + user.id + '\n' + 'first name: ' + user.first_name + '\n' + 'last name: ' + user.last_name);
       
               } else {
       
                   alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
       
               }
       
           });
       
       }
       
       // Listen for click events.
       
       SHOW_ME.addEventListener('click', function() {
       
           show_me();
       
       });
       
       win.open();
       
       
    Make sure you have a user created in the platform. And, use that user email and pass in the above code in the cloud login function.
  4. heedoo moon 2016-06-30

    I don't understand how does your code work. Because your sample "response_json_depth:2" parameter is in callback. For example) Cloud.Users.showMe(function(e) { response_json_depth:2 above code should be ==> Cloud.Users.showMe({response_json_depth:2}, function(e) {
  5. Sharif AbuDarda 2016-07-01

    Hello, Try using the code that I sent. This should work for you. Closing the ticket.
  6. heedoo moon 2016-07-01

    Sharif, I already tried not not working for me. Have you tried with my code and same version?
  7. Emmanuel Francis 2018-04-27

    I am trying to call this as follows: Cloud.Users.showMe({ response_json_depth:2 },function (e) { if (e.success) { var user = e.users[0]; alert('Success:\n' + 'id: ' + user.id + '\n' + 'first name: ' + user.first_name + '\n' + 'last name: ' + user.last_name); } else { alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e))); } }); And it gives me below error: Script Error Argument callback was an unexpected type! Expected: function, Received: object

JSON Source