lundi 11 septembre 2017

torii facebook ember get user and name

Hi I want to get name and email from facebook authentication via torii and simple-auth, but I don't know how recovery this data. I can login via facebook but I can't get name or email.

Could you helpme please

This is my code:

    //import Base from 'ember-simple-auth/authenticators/base';
import Ember from 'ember';
import ToriiAuthenticator from 'ember-simple-auth/authenticators/torii';

export default ToriiAuthenticator.extend({
  torii: Ember.inject.service()
});

This is my component login-form

  import Ember from 'ember';

export default Ember.Component.extend({

  actions:{
    facebookLogin(){
      this.get('session').authenticate('authenticator:torii', 'facebook-oauth2').then((data)=>{
            alert("logueado" + data); 

        });

    }
  }
});

And my torii-provider

// app/torii-providers/facebook.js
import FacebookOauth2Provider from 'torii/providers/facebook-oauth2';

export default FacebookOauth2Provider.extend({
  fetch(data) {
    return data;
  }
});




Aucun commentaire:

Enregistrer un commentaire