<script>
function login() {
// Log the user in via Twitter
var provider = new firebase.auth.TwitterAuthProvider();
firebase.auth().signInWithPopup(provider).catch(function(error) {
console.log("Error authenticating user:", error);
});
}
firebase.auth().onAuthStateChanged(function(user) {
// Once authenticated, instantiate Firechat with the logged in user
if (user) {
initChat(user);
}
});
</script>
<div class="top-pad"></div>
<button onclick="login()">Login with Twitter</button>
</div>
<script>
function initChat(user) {
// Get a Firebase Database ref
var chatRef = firebase.database().ref("chat");
// Create a Firechat instance
var chat = new FirechatUI(chatRef, document.getElementById("firechat-wrapper"));
// Set the Firechat user
chat.setUser(user.uid, user.displayName);
}
</script>
<div id="firechat-wrapper"></div>
I did only this. This code added to my html page. But how to connect to my firebase project. Is there any documentation.
I did only this. This code added to my html page. But how to connect to my firebase project. Is there any documentation.