TypeError: Cannot read property 'uid' of undefined

Hello!
I have the following question as to how I could be solving this problem with the property uid with authentication via facebook / firebase

Services![image](upload://hzdVBkJUIyrskqPxpZ3xSH755aC.png)
'use strict';



//app.factory('Auth', function($firebaseAuth, $firebaseObject, $firebaseArray,$state, $http, $q) {
    
app.factory('Auth', function ($firebaseAuth, $firebaseObject, $firebaseArray, $state, $http, $q, $cordovaOauth) {
    var ref = firebase.database().ref();
    var auth = $firebaseAuth();

    var Auth = {

        createProfile: function(uid, profile) {
            return ref.child('profiles').child(uid).set(profile);
        },

        getProfile: function(uid) {
            return $firebaseObject(ref.child('profiles').child(uid));
        },

        login: function() {
            var provider = new firebase.auth.FacebookAuthProvider();
            provider.addScope('public_profile, email, user_location, user_birthday, user_photos, user_about_me');

                      $cordovaOauth.facebook("1455510817798096", ["public_profile", "email", "user_location", "user_birthday", "user_photos", "user_about_me"])
                      .then(function (result) {

                    var user = Auth.getProfile(result.user.uid).$loaded();
                   
                    user.then(function(profile) {
                        if (profile.name == undefined) {

                            var genderPromise = $http.get('https://graph.facebook.com/me?fields=gender&access_token=' + accessToken);
                            var birthdayPromise = $http.get('https://graph.facebook.com/me?fields=birthday&access_token=' + accessToken);
                            var locationPromise = $http.get('https://graph.facebook.com/me?fields=location&access_token=' + accessToken);
                            var bioPromise = $http.get('https://graph.facebook.com/me?fields=about&access_token=' + accessToken);
                            var imagesPromise = $http.get('https://graph.facebook.com/me/photos/uploaded?fields=source&access_token=' + accessToken);
                            var promises = [genderPromise, birthdayPromise, locationPromise, bioPromise, imagesPromise];

                            $q.all(promises).then(function(data) {
                                var info = result.user.providerData[0];
                                var profile = {
                                    name: info.displayName,
                                    email: info.email,
                                    avatar: info.photoURL,
                                    gender: data[0].data.gender ? data[0].data.gender : "",
                                    birthday: data[1].data.birthday ? data[1].data.birthday : "",
                                    age: data[1].data.birthday ? Auth.getAge(data[1].data.birthday) : "",
                                    location: data[2].data.location ?  data[2].data.location.name : "",
                                    bio: data[3].data.about ? data[3].data.about : "",
                                    images: data[4].data.data
                                }
                                Auth.createProfile(result.user.uid, profile);
                            });
                        }
                    });
                });
        },

        logout: function() {
            return auth.$signOut();
        },
         getAbout: function(access_token) {
			return $http.get('https://graph.facebook.com/me?fields=bio&access_token=' + access_token);
		},

		

        getAge: function(birthday) {
            return new Date().getFullYear() - new Date(birthday).getFullYear();
        },

        requireAuth: function() {
            return auth.$requireSignIn();
        },
        getProfilesByAge: function(age) {
			return $firebaseArray(ref.child('profiles').orderByChild('age').startAt(18).endAt(age));
		},
		getProfiles: function(){
			return $firebaseArray(ref.child('profiles'));
		} 				

    };

   auth.$onAuthStateChanged(function(authData) {
        if(authData) {
            console.log('Este usuario ja se encontra logado!');
        } else {
            $state.go('login');
            console.log('Este usuario ainda nao se encontra logado no aplicativo da cleo.');
        }
    });

    return Auth;

});

````Preformatted text`

controller

‘use strict’;

app.controller(‘AuthCtrl’, function(Auth, $state) {

var auth = this;

auth.login = function() {
    console.log('Usuario clicou no botao para realizar login!');

         return Auth.login(function(user) {
		$state.go('app.home');
	});

};



auth.logout = function() {
    Auth.logout();
};

});