This repository was archived by the owner on Jun 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
Get permission_denied #112
Copy link
Copy link
Closed
Description
Hi everyone!
I tried the example by using anonymous user on this git.
I works flawless.
But when I changed it into my database & auth key, it did not work.
Here's the code
`
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<!-- Firebase -->
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase.js"></script>
<!-- Firechat -->
<link rel="stylesheet" href="https://cdn.firebase.com/libs/firechat/3.0.1/firechat.min.css" />
<script src="https://cdn.firebase.com/libs/firechat/3.0.1/firechat.min.js"></script>
<!-- Custom CSS -->
<style>
#firechat-wrapper {
height: 475px;
max-width: 325px;
padding: 10px;
border: 1px solid #ccc;
background-color: #fff;
margin: 50px auto;
text-align: center;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 5px 25px #666;
-moz-box-shadow: 0 5px 25px #666;
box-shadow: 0 5px 25px #666;
}
</style>
firebase.initializeApp(config);
// Get a reference to the Firebase Realtime Database
var chatRef = firebase.database().ref();
// Create an instance of Firechat
var chat = new FirechatUI(chatRef, document.getElementById("firechat-wrapper"));
// Listen for authentication state changes
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// If the user is logged in, set them as the Firechat user
chat.setUser(user.uid, "Anonymous" + user.uid.substr(10, 8));
} else {
// If the user is not logged in, sign them in anonymously
firebase.auth().signInAnonymously().catch(function(error) {
console.log("Error signing user in anonymously:", error);
});
}
});
</script>
How could I make this work?
Is there any database configuration to figure it out?
Which part did I miss?
Thanks in advance,
Best Regards
Metadata
Metadata
Assignees
Labels
No labels