Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service login TypeError: Cannot read property '0' of undefined #361

Open
tony-h opened this issue Jun 28, 2016 · 1 comment
Open

Service login TypeError: Cannot read property '0' of undefined #361

tony-h opened this issue Jun 28, 2016 · 1 comment

Comments

@tony-h
Copy link

tony-h commented Jun 28, 2016

When a user logs in using a service such as Google or Facebook, meteor-admin generates an error when viewing the users collection.

TypeError: Cannot read property '0' of undefined
    at render (http://localhost:3000/packages/yogiben_admin.js?hash=cbfd8ed62678a0a41dc066c81cba0b8684e0b5d4:653:23)
    at http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1334:12
    at Object.oCol.fnGetData (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:820:5)
    at _fnGetCellData (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1227:28)
    at _fnCreateTr (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1809:22)
    at _fnAddData (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1152:4)
    at _fnAjaxUpdateDraw (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:2817:4)
    at http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:2662:6
    at callback (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:2554:4)
    at jQuery.ajax (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:15712:7) undefined

The issue is return value[0].address at marker //192

    columns: _.union([                                                                                                 // 172
      {                                                                                                                //
        data: '_id',                                                                                                   // 184
        title: 'Admin',                                                                                                // 184
        createdCell: function(node, cellData, rowData) {                                                               // 184
          return $(node).html(Blaze.toHTMLWithData(Template.adminUsersIsAdmin, {                                       //
            _id: cellData                                                                                              // 189
          }));                                                                                                         //
        },                                                                                                             //
        width: '40px'                                                                                                  // 184
      }, {                                                                                                             //
        data: 'emails',                                                                                                // 192
        title: 'Email',                                                                                                // 192
        render: function(value) {                                                                                      // 192
          return value[0].address;                                                                                     //
        },                                                                                                             //
        searchable: true                                                                                               // 192
      }, {                                                                                                             //
        data: 'emails',                                                                                                // 199
        title: 'Mail',                                                                                                 // 199
        createdCell: function(node, cellData, rowData) {                                                               // 199
          return $(node).html(Blaze.toHTMLWithData(Template.adminUsersMailBtn, {                                       //
            emails: cellData                                                                                           // 204
          }));                                                                                                         //
        },                                                                                                             //
        width: '40px'                                                                                                  // 199
      }, {                                                                                                             //
        data: 'createdAt',                                                                                             // 207
        title: 'Joined'                                                                                                // 207
      }                                                                                                                //
    ], adminEditDelButtons),  

Here is a look at the user data from a Google login:

    "_id" : "vxP...StGgb", 
    "createdAt" : ISODate("..."), 
    "services" : 
    { 
        "google" : 
        { 
            "accessToken" : "ya2...QfQ", 
            "idToken" : "eyJ...GLg",
            "expiresAt" : 14...29,
            "scope" : [ "...", "..." ],
            "id" : "10...0",
            "email" : "[email protected]",
            "verified_email" : true,
            "name" : "Some User",
            "given_name" : "First",
            "family_name" : "Last",
            "picture" : ".../photo.jpg",
            "locale" : "en" 
        },
        "resume" : 
        { 
            "loginTokens" : [ { "when" : ISODate("..."), "hashedToken" : "uJo...hN7ow=" } ] 
        } 
    }, 
    "profile" : 
    { 
        "name" : "First Last",
        "otherField" : false 
    } 
@consciousweb
Copy link

did you ever figure out how to fix this? It occurs on my users page, and wont display the users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants