admin管理员组文章数量:1291720
How do I get the current user's information in my application without using a listener like onStateChanged
? Right now I'm using:
auth.createUserWithEmailAndPassword(email,password).then(function(user){ }
to get the user info then assign it to a variable .. but when I refresh the page, the variable loses its assigned value
How do I get the current user's information in my application without using a listener like onStateChanged
? Right now I'm using:
auth.createUserWithEmailAndPassword(email,password).then(function(user){ }
to get the user info then assign it to a variable .. but when I refresh the page, the variable loses its assigned value
Share Improve this question edited Nov 22, 2016 at 15:47 Frank van Puffelen 600k85 gold badges889 silver badges859 bronze badges asked Nov 22, 2016 at 14:38 Nevin Nevin 3751 gold badge7 silver badges18 bronze badges2 Answers
Reset to default 6According to the docs using currentUser
should do the trick:
var user = firebase.auth().currentUser;
if (user) {
// User is signed in.
} else {
// No user is signed in.
}
Make a synchronous call by using $firebaseAuth
service
$firebaseAuth().$getAuth();
It will return the currently signed-in user or null
if no user is signed in.
本文标签: javascriptGetting Firebase Current User InfoStack Overflow
版权声明:本文标题:javascript - Getting Firebase Current User Info - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741535973a2384026.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论