2016-07-25 2 views
3

Firebase v3 Auth는 displayNamephotoURL을 Firebase에 전달하는 updateProfile 메소드를 제공합니다.Firebase v3 updateProfile 방법

제 생각에 이러한 속성은 사용자 로그인시 타사 oAuth 공급자 인 Google, Facebook, Twitter 또는 GitHub에서 검색됩니다. 비밀번호 기반 인증의 경우 관리 콘솔에서 볼 수 없거나 볼 수 없습니다.

비밀번호 인증 계정에이 정보를 저장할 수 있습니까? 그렇다면 관리 콘솔을 통해이 정보를 보거나 관리 할 수 ​​있습니까?

BTW : 실시간 데이터베이스에 users 노드/지점 아래에이 정보를 저장할 수 있지만이 정보를 Firebase Auth 시스템에 저장하는 방법에 대해 알고 싶습니다.

enter image description here

// Updates the user attributes: 
user.updateProfile({ 
    displayName: "Jane Q. User", 
    photoURL: "https://example.com/jane-q-user/profile.jpg" 
}).then(function() { 
    // Profile updated successfully! 
    // "Jane Q. User" 
    var displayName = user.displayName; 
    // "https://example.com/jane-q-user/profile.jpg" 
    var photoURL = user.photoURL; 
}, function(error) { 
    // An error happened. 
}); 

// Passing a null value will delete the current attribute's value, but not 
// passing a property won't change the current attribute's value: 
// Let's say we're using the same user than before, after the update. 
user.updateProfile({photoURL: null}).then(function() { 
    // Profile updated successfully! 
    // "Jane Q. User", hasn't changed. 
    var displayName = user.displayName; 
    // Now, this is null. 
    var photoURL = user.photoURL; 
}, function(error) { 
    // An error happened. 
}); 

답변

3

.updateProfile 저장 중포 기지 인증 시스템의 displayNamephotoURL 및 특성. 따라서 실시간 데이터베이스의 users 노드 아래에서이 항목을 설정하거나 가져올 필요가 없습니다.

Firebase v3 Auth Console에는 이러한 속성이 표시되지 않습니다. 그렇게 볼 수는 없습니다.

registerPasswordUser(email,displayName,password,photoURL){ 
    var user = null; 
    //nullify empty arguments 
    for (var i = 0; i < arguments.length; i++) { 
    arguments[i] = arguments[i] ? arguments[i] : null; 
    } 

    firebase.auth().createUserWithEmailAndPassword(email, password) 
    .then(function() { 
    user = firebase.auth().currentUser; 
    user.sendEmailVerification(); 
    }) 
    .then(function() { 
    user.updateProfile({ 
     displayName: displayName, 
     photoURL: photoURL 
    }); 
    }) 
    .catch(function(error) { 
    console.log(error.message); 
    }); 
    console.log('Validation link was sent to ' + email + '.'); 
} 
:

는 암호 사용자를 등록하는 방법을 여기에서,로 압연

관련 문제