dist/evrythng.js
function authFacebook(response) {
    var $this = this;

    return EVT.api({
      url: '/auth/facebook',
      method: 'post',
      data: {
        access: {
          token: response.authResponse.accessToken
        }
      },
      authorization: this.apiKey
    }).then(function (access) {

      // Create User Scope with the user information and Api Key returned
      // from the REST API.
      var user = new EVT.User({
        id: access.evrythngUser,
        apiKey: access.evrythngApiKey
      }, $this);

      // Fetch user dto from the platform and then
      // return initial response
      // TODO: Introduce proper read when DEV-190 merged
      return EVT.api({
        url: '/users/' + user.id,
        authorization: user.apiKey
      }).then(function(userDetails) {
        // Prepare resolve object. Move Facebook user data to
        // 'user.facebook' object
        Utils.extend(user, { facebook: response.user }, true);

        // Merge user data from the platform to User Scope
        Utils.extend(user, userDetails, true);

        response.user = user;

        return response;
      });
    });
  }
function authFacebook(response) {
    var $this = this;

    return EVT.api({
      url: '/auth/facebook',
      method: 'post',
      data: {
        access: {
          token: response.authResponse.accessToken
        }
      },
      authorization: this.apiKey
    }).then(function (access) {

      // Create User Scope with the user information and Api Key returned
      // from the REST API.
      var user = new EVT.User({
        id: access.evrythngUser,
        apiKey: access.evrythngApiKey
      }, $this);

      // Fetch user dto from the platform and then
      // return initial response
      // TODO: Introduce proper read when DEV-190 merged
      return EVT.api({
        url: '/users/' + user.id,
        authorization: user.apiKey
      }).then(function(userDetails) {
        // Prepare resolve object. Move Facebook user data to
        // 'user.facebook' object
        Utils.extend(user, { facebook: response.user }, true);

        // Merge user data from the platform to User Scope
        Utils.extend(user, userDetails, true);

        response.user = user;

        return response;
      });
    });
  }
function authFacebook ( response ) { var $this = this ; return EVT . api ( { url : '/auth/facebook' , method : 'post' , data : { access : { token : response . authResponse . accessToken } } , authorization : this . apiKey } ) . then ( function ( access ) { // Create User Scope with the user information and Api Key returned // from the REST API. var user = new EVT . User ( { id : access . evrythngUser , apiKey : access . evrythngApiKey } , $this ) ; // Fetch user dto from the platform and then // return initial response // TODO: Introduce proper read when DEV-190 merged return EVT . api ( { url : '/users/' + user . id , authorization : user . apiKey } ) . then ( function ( userDetails ) { // Prepare resolve object. Move Facebook user data to // 'user.facebook' object Utils . extend ( user , { facebook : response . user } , true ) ; // Merge user data from the platform to User Scope Utils . extend ( user , userDetails , true ) ; response . user = user ; return response ; } ) ; } ) ; }
Send authentication request with the Facebook auth token. This method is used on explicit login and when Facebook is initialized in the `EVT.App` constructor.
Send authentication request with the Facebook auth token . This method is used on explicit login and when Facebook is initialized in the EVT . App constructor .