最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - firebase.auth(...).getUserByEmail is not a function - Stack Overflow

programmeradmin2浏览0评论

In my project I need to link an existing email account whithout the user signed in. I have the user's email, so I'm trying this code:

firebase.auth().getUserByEmail(useremail);

on the client side. But it gives me the firebase.auth(...).getUserByEmail is not a function error.

Does anyone know how to get the user by email address on the client side so I can link the accounts, the existing one and the providers?

Thanks in advance.

Using sdk 17.4.5

In my project I need to link an existing email account whithout the user signed in. I have the user's email, so I'm trying this code:

firebase.auth().getUserByEmail(useremail);

on the client side. But it gives me the firebase.auth(...).getUserByEmail is not a function error.

Does anyone know how to get the user by email address on the client side so I can link the accounts, the existing one and the providers?

Thanks in advance.

Using sdk 17.4.5

Share asked May 22, 2020 at 15:12 lrentelrente 1,1401 gold badge10 silver badges30 bronze badges 1
  • I think the getUserByEmail method is only available for the Firebase Admin SDK. You might want to use some kind of server (or cloud function) so you could use the Firebase Admin SDK to fetch the user by E-mail. – Angel González Commented May 22, 2020 at 15:28
Add a ment  | 

1 Answer 1

Reset to default 8

For web clients, firebase.auth() returns an Auth object. As you can see from the API documentation, there is no getUserByEmail method. on it. You're probably looking at the API documentation for Auth from the Firebase Admin SDK, which does not work on web clients. It only works on backends running nodejs.

If you want to use getUserByEmail, you'll need to run it on a backend, and invoke that from your web client.

You should know that linking user accounts does actually require the use of this method. You link accounts after the user has signed in to both of them.

发布评论

评论列表(0)

  1. 暂无评论