title: Firebase access denied?
body: <p>So I have this little code snippet that is responsible for uploading a picture to the firebase storage. For some odd reason, my access keeps getting denied. There seems to be a problem with storageRef because it goes into the if statement that prints out the  error.</p>
  
  <pre><code>  // will handle the  sign up of a user
      @objc func handleSignUp(){
          // first we cant to take sure that all of the fields are filled
          var profilePic: String = ""
  
          // will take the user selected image and load it to firebase
          let imageName = NSUUID().uuidString
   let storageRef = Storage.storage().reference().child("profile_images").child("\(imageName).PNG")
          if let userImage = selectedImageFromPicker,let uploadData = UIImageJPEGRepresentation(userImage, 0.1){
  
              storageRef.putData(uploadData, metadata: nil, completion: { (metadata, error) in
                  if error != nil{
                      print(error ?? "")
                      return
                  }
                   profilePic = (metadata?.downloadURL()!.absoluteString)!
                  guard let username = self.nameTextField.text,
                      let confirmPassword = self.confirmPasswordTextField.text,
                      let email = self.emailTextField.text,
                      let password = self.passwordTextField.text,
                      !username.isEmpty,
                      !email.isEmpty,
                      !password.isEmpty,
                      !confirmPassword.isEmpty
                      else {
  
                          print("Required fields are not all filled!")
                          return
                  }
                  if self.validateEmail(enteredEmail:email) != true{
                      let alertController = UIAlertController(title: "Error", message: "Please Enter A Valid Email", preferredStyle: .alert)
                      let defaultAction = UIAlertAction(title: "Ok", style: .cancel, handler: nil)
                      alertController.addAction(defaultAction)
                      self.present(alertController, animated: true, completion: nil)
                  }
  
                  // will make sure user is validated before it even tries to create user
  
                  // will make sure the password and confirm password textfields have the same value if so it will print an error
                  if self.passwordTextField.text != self.confirmPasswordTextField.text {
                      let alertController = UIAlertController(title: "Error", message: "Passwords Don't Match", preferredStyle: .alert)
                      let defaultAction = UIAlertAction(title: "Ok", style: .cancel, handler: nil)
                      alertController.addAction(defaultAction)
                      self.present(alertController, animated: true, completion: nil)
                  }
  
                  // will authenticate a user into the authentication services with an email and passowrd
                  AuthService.createUser(controller: self, email: email, password: password) { (authUser) in
                      guard let firUser = authUser else {
                          return
                      }
                      //will add user to the database
                      print(profilePic)
                      print(username)
                      UserService.create(firUser, username: username , profilePic: profilePic,location: self.userLocation!) { (user) in
                          guard let user = user else {
                              print("User successfully loaded into firebase db")
                              return
                          }
                          // will set the current user for userdefaults to work
                          print(user.profilePic)
                          print(user.username)
  
                          User.setCurrent(user, writeToUserDefaults: true)
                          // self.delegate?.finishSigningUp()
  
                          self.finishSigningUp()
  
  
                      }
                  }
  
          })
          }
      }
  </code></pre>
  
  <p>The error is </p>
  
  <pre><code>Error Domain=FIRStorageErrorDomain Code=-13021 "User does not have permission to access gs://eventful-3d558.appspot.com/profile_images/C0BC898A-6A6F-490F-954B-51D705CD2B23.PNG." UserInfo={object=profile_images/C0BC898A-6A6F-490F-954B-51D705CD2B23.PNG, bucket=eventful-3d558.appspot.com, ResponseBody={
    "error": {
      "code": 403,
      "message": "Permission denied. Could not perform this operation"
    }
  </code></pre>
  
  <p>If anyone knows what it is I would appreciate your help. It is preventing me from signing up users.</p>