{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vuefire/issues/47","repository_url":"https://api.github.com/repos/vuejs/vuefire","labels_url":"https://api.github.com/repos/vuejs/vuefire/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vuefire/issues/47/comments","events_url":"https://api.github.com/repos/vuejs/vuefire/issues/47/events","html_url":"https://github.com/vuejs/vuefire/issues/47","id":189003568,"number":47,"title":"Auth examples","user":{"login":"ryanmclaughlin","id":451112,"avatar_url":"https://avatars.githubusercontent.com/u/451112?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanmclaughlin","html_url":"https://github.com/ryanmclaughlin","followers_url":"https://api.github.com/users/ryanmclaughlin/followers","following_url":"https://api.github.com/users/ryanmclaughlin/following{/other_user}","gists_url":"https://api.github.com/users/ryanmclaughlin/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanmclaughlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanmclaughlin/subscriptions","organizations_url":"https://api.github.com/users/ryanmclaughlin/orgs","repos_url":"https://api.github.com/users/ryanmclaughlin/repos","events_url":"https://api.github.com/users/ryanmclaughlin/events{/privacy}","received_events_url":"https://api.github.com/users/ryanmclaughlin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-13T23:28:33Z","updated_at":"2016-11-18T07:11:50Z","closed_at":"2016-11-18T03:17:01Z","body":"Hi there,\r\n\r\nI'm having trouble getting auth to work. I have successfully implemented the ability to create and login to an account, but I'm having trouble getting the `currentUser` with the function `onAuthStateChanged`.\r\n\r\nDoes anyone have any Vue 2.0, vue-router, and Firebase 3+ examples of auth successfully implemented that would steer me in the right direction?\r\n\r\n**/views/Auth.vue**\r\n``` vue\r\n<script>\r\n  import firebase from '../services/firebase.js'\r\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        email: '',\r\n        password: '',\r\n        confirmPassword: '',\r\n        wantsToSignUp: false,\r\n        errorMessage: '',\r\n      };\r\n    },\r\n    methods: {\r\n      signUpWithPassword() {\r\n        if (this.password === this.confirmPassword) {\r\n          firebase.auth.createUserWithEmailAndPassword(this.email, this.password)\r\n          .then(() => this.signInWithPassword())\r\n          .catch((error) => { this.errorMessage = error.message });\r\n        }\r\n      },\r\n      signInWithPassword() {\r\n        return firebase.auth.signInWithEmailAndPassword(this.email, this.password)\r\n        .then((userData) => {\r\n          this.onSignedIn();\r\n          return userData;\r\n        })\r\n        .catch((error) => { this.errorMessage = error.message });\r\n      },\r\n      onSignedIn() {\r\n        this.$router.go('/');\r\n      },\r\n    },\r\n  };\r\n</script>\r\n```\r\n\r\nAppNav always reports unknown `user.title` after I am logged in.\r\n\r\n**/components/AppNav.vue**\r\n``` vue\r\n<script>\r\n  import firebase from '../services/firebase.js'\r\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        user: null,\r\n        searchQuery: '',\r\n      };\r\n    },\r\n    methods: {\r\n      processUser(authed) {\r\n        console.log(authed);\r\n        if (authed === null) {\r\n          this.user = null;\r\n          return;\r\n        }\r\n        this.user = {\r\n          title: authed.email || '',\r\n        };\r\n      },\r\n      signOut() {\r\n        firebase.auth.signOut();\r\n        this.$router.go('auth');\r\n      },\r\n    },\r\n    ready() {\r\n      firebase.auth.onAuthStateChanged(this.processUser);\r\n      this.processUser(firebase.auth.currentUser);\r\n    },\r\n  };\r\n</script>\r\n```"},"comment":{"url":"https://api.github.com/repos/vuejs/vuefire/issues/comments/261464306","html_url":"https://github.com/vuejs/vuefire/issues/47#issuecomment-261464306","issue_url":"https://api.github.com/repos/vuejs/vuefire/issues/47","id":261464306,"user":{"login":"chrisbraddock","id":130854,"avatar_url":"https://avatars.githubusercontent.com/u/130854?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisbraddock","html_url":"https://github.com/chrisbraddock","followers_url":"https://api.github.com/users/chrisbraddock/followers","following_url":"https://api.github.com/users/chrisbraddock/following{/other_user}","gists_url":"https://api.github.com/users/chrisbraddock/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisbraddock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisbraddock/subscriptions","organizations_url":"https://api.github.com/users/chrisbraddock/orgs","repos_url":"https://api.github.com/users/chrisbraddock/repos","events_url":"https://api.github.com/users/chrisbraddock/events{/privacy}","received_events_url":"https://api.github.com/users/chrisbraddock/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T07:11:50Z","updated_at":"2016-11-18T07:11:50Z","body":"see if this helps: [https://github.com/chrisbraddock/vuefire-auth-demo](https://github.com/chrisbraddock/vuefire-auth-demo)"}}
{"actor":{"display_login":"chrisbraddock"}}