facebookLogin() {
    const self = this

    FBSDKLoginManager.logInWithReadPermissions([], (error, result) => {
      FBSDKAccessToken.getCurrentAccessToken(credentials => {
        const authData = {
          facebook: {
            id: credentials.userID,
            access_token: credentials.tokenString,
            expiration_date: new Date(credentials._expirationDate).toISOString()
          }
        }

        let fetchRequest = new FBSDKGraphRequest((error, result) => {
          if (error) {
            AlertIOS.alert("Failed to retrieve graph data.")
            return
          }

          let fields = {}

          if (result.picture && result.picture.data && result.picture.data.url) {
            fields.fbPhoto = result.picture.data.url
          }

          if (result.name) {
            fields.username = credentials.userID
          }

          if (result.gender) {
            fields.gender = result.gender
          }

          fields.authData = authData

          this.props.logInFacebook(fields)
        }, 'me?fields=picture,name,gender')

        fetchRequest.start()
      })
    })
  }
/**
   * Handles users who register/sign-in with Facebook. When a user logIns with Facebook their graph data is fetched as well.
   *
   * @return {void}
   */
Handles users who register/sign-in with Facebook. When a user logIns with Facebook their graph data is fetched as well.
@return {void}
Handles users who register / sign - in with Facebook . When a user logIns with Facebook their graph data is fetched as well . @return { void }
facebookLogin() {
    const self = this
    FBSDKLoginManager.logInWithReadPermissions([], (error, result) => {
      FBSDKAccessToken.getCurrentAccessToken(credentials => {
        const authData = {
          facebook: {
            id: credentials.userID,
            access_token: credentials.tokenString,
            expiration_date: new Date(credentials._expirationDate).toISOString()
          }
        }
        let fetchRequest = new FBSDKGraphRequest((error, result) => {
          if (error) {
            AlertIOS.alert("Failed to retrieve graph data.")
            return
          }
          let fields = {}
          if (result.picture && result.picture.data && result.picture.data.url) {
            fields.fbPhoto = result.picture.data.url
          }
          if (result.name) {
            fields.username = credentials.userID
          }
          if (result.gender) {
            fields.gender = result.gender
          }
          fields.authData = authData
          this.props.logInFacebook(fields)
        }, 'me?fields=picture,name,gender')
        fetchRequest.start()
      })
    })
  }
facebookLogin ( ) { const self = this FBSDKLoginManager . logInWithReadPermissions ( [ ] , ( error , result ) => { FBSDKAccessToken . getCurrentAccessToken ( credentials => { const authData = { facebook : { id : credentials . userID , access_token : credentials . tokenString , expiration_date : new Date ( credentials . _expirationDate ) . toISOString ( ) } } let fetchRequest = new FBSDKGraphRequest ( ( error , result ) => { if ( error ) { AlertIOS . alert ( "Failed to retrieve graph data." ) return } let fields = { } if ( result . picture && result . picture . data && result . picture . data . url ) { fields . fbPhoto = result . picture . data . url } if ( result . name ) { fields . username = credentials . userID } if ( result . gender ) { fields . gender = result . gender } fields . authData = authData this . props . logInFacebook ( fields ) } , 'me?fields=picture,name,gender' ) fetchRequest . start ( ) } ) } ) }
Handles users who register/sign-in with Facebook.
Handles users who register / sign - in with Facebook .