小编the*_*lin的帖子

Firebase:User.photoUrl 到字符串

我试图将所有用户的个人资料照片存储在实时数据库中,但遇到了问题。

当尝试使用此代码上传 PhotoUrl 时,会出现此错误。

代码:

var user = firebase.auth().currentUser;

user.updateProfile({

  // Here, "name" and "imgUrl" are parameters of parent function.
  // I don't think this is the reason, but if it helps,
  // "imgUrl" always come from a <img> src.
  displayName: name,
  photoUrl: imgUrl

}).then(function(){

  // Here is where I try to upload all to the database
  firebase.database().ref("/Usuarios/" + user.uid).set({
    "email": email,
    "name": name,
    "photoUri": user.photoUrl, // This is where I think the problem originates.
    "uid": user.uid  // This calls …
Run Code Online (Sandbox Code Playgroud)

javascript web firebase

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

firebase ×1

javascript ×1

web ×1