Uploaded image for project: 'Appcelerator Modules'
  1. Appcelerator Modules
  2. MOD-2270

Appcelerator Titanium Facebook request doesn't return email on iOS

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Facebook
    • Labels:
    • Environment:

      Appcelerator Studio, build: 4.6.0.201605201934
      SDK: 5.3.1GA,
      MacOSX
      facebook: 5.2.0

      Description

      I am trying to to receive email of user logged in via Facebook. On iOS it reuturns me data without email.

      Important:
      This is not account problem (it returns email on Android) nor module configuration error (I can log in/log out and retreive other data)

      Steps to reproduce

      var viewClick = function() {
          fb.logout();
          fb.initialize(); 
          fb.authorize();
      };
       
      var facebookLogged = function(e) {
          Ti.API.info('results From Event: ' + JSON.stringify(e))
          fb.requestWithGraphPath("me?fields=name,email,first_name,last_name", {}, 'GET', function(result) {
          //  fb.requestWithGraphPath("me", { fields: "name,email,first_name,last_name"}, 'GET', function(result) {
              Ti.API.info('results From Graph API: ' + JSON.stringify(result))
              var data = JSON.parse(result.result);
              Ti.API.info("-- email: " + data.email);
          });
      };
       
       
      var window = Ti.UI.createWindow({exitOnClose: true, navBarHidden: true, fullscreen: true, orientationModes: [
              Ti.UI.PORTRAIT,
              Ti.UI.UPSIDE_PORTRAIT,      
          ],
          backgroundColor: '#f0f2f2'
      }); 
       
      var fb = require('facebook');
       
      if(Ti.Platform.osname === 'android') {
       
          window.fbProxy = fb.createActivityWorker({lifecycleContainer: window});
      }
       
          //fb.setLoginBehavior(fb.LOGIN_BEHAVIOR_NATIVE);
      fb.permissions = ['email'];
       
      window.open();
       
       
      var view = Ti.UI.createView({
          height: 200,
          width: 200,
          backgroundColor: 'red'
      }); 
       
      view.addEventListener('click', viewClick);
       
      window.add(view);
      fb.addEventListener('login', facebookLogged);
      

      Results are:

      results From Event: {"success":true,"code":0,"data":"{\"firstName\":\"Eren\",\"lastName\":\"Kars\",\"userID\":\"1498651573764560\",\"middleName\":\"\",\"name\":\"Eren Kars\",\"linkURL\":\"https:\\/\\/www.facebook.com\\/app_scoped_user_id\\/1498651573764560\\/\"}","uid":"1498651573764560","cancelled":false,"bubbles":true,"type":"login","source":{"id":"facebook"},"cancelBubble":false}
       
      results From Graph API: {"result":"{\"id\":\"1498651573764560\",\"last_name\":\"Kars\",\"name\":\"Eren Kars\",\"first_name\":\"Eren\"}","success":true,"path":"me?fields=name,email,first_name,last_name"}
       
      -- email: undefined
      
      

      There is no problem with configuration/module because:

      • I made it working on Android (it returns email),
      • It works fine with logging in (both on Android/iOS),
      • It returns all the fields except email and gives no errors with Graph API.

        Attachments

          Activity

            People

            • Assignee:
              hknoechel Hans Knöchel
              Reporter:
              CREATIVE KAIZEN CREATIVE KAIZEN
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code