首页 > 解决方案 > 获取带有 firebase id 的 google 个人资料图片

问题描述

我一直在使用 firebase 进行登录,它返回给我一个 firebase 的 uid,正如我所见,它不可能发出获取 google id 的请求。

我知道 firebase 帐户与 Google 的帐户不同,但我的问题是:有一些可能的方法可以使用 firebase 帐户 uid 来获取 Google 个人资料图片,而无需更改我的登录方法以使用 Google+ 登录?

这是获取 Google 个人资料照片的 URL:https ://developers.google.com/apis-explorer/#search/profile/m/plus/v1/plus.people.get

标签: firebasegoogle-apifirebase-authenticationgoogle-authentication

解决方案


您应该能够使用他们的 uid 获取用户个人资料。您可以使用

admin.auth().getUser(uid).then(function(profile){...})

拥有帐户后,您应该能够使用 firebase 属性访问他们的个人资料,在您的情况下使用 photoURL 属性。希望这有助于 https://firebase.google.com/docs/auth/admin/manage-users


推荐阅读