title: Firebase database Permission denied error facing using swift 4.2
body: <pre><code>guard let uid = user?.uid  else {return}
  
  let usernameValue = ["username":username]
  let value = [uid: usernameValue]
  
  Database.database().reference().child("user").updateChildValues(value, withCompletionBlock: { (err, ref) in
      if let err = err{
          print("failed to save user in db:", err)
      }else{
          print("successfully Work")
      }
  })
  </code></pre>
  
  <p>This is the error I am facing:</p>
  
  <blockquote>
    <p>failed to save user in db: Error Domain=com.firebase Code=1 "Permission denied" UserInfo={NSLocalizedDescription=Permission denied}</p>
  </blockquote>