0

NSLocalizedDescription=User is not authenticated, please authenticate using Firebase Authentication and try again., ResponseErrorDomain=com.google.HTTPStatus, ResponseErrorCode=401}

I am getting this error for no clear reason. My app was working perfectly fine for the past few weeks but now all of a sudden i'm getting this. I have not changed a single thing related to my login or authentication. There is something wrong with firebase. Have I reached some sort of limit?

When I try to view an image from firebase, it doesn't work anymore. And when I try to upload an image using the code below, I get an error.

    static func uploadCollage(_ image: UIImage, delegate: BottomProfileViewController) {
    guard let uid = Auth.auth().currentUser?.uid else {
        print("error uploading image")
        return
    }
    let refStore = Storage.storage().reference().child("collage").child(uid + ".jpg")
    let imageData = UIImageJPEGRepresentation(image, 0.01)
    refStore.putData(imageData!, metadata: nil) { (meta, err) in
        if err != nil {
            print("error uploading image data ", err ?? "")
            return
        }
        delegate.spinner.stopAnimating()
        delegate.collage.alpha = 1
        print(meta ?? "no meta")
        let url = String(describing: (meta?.downloadURL())!)
        LoadRequests.gRef.child("Users").child(uid).child("Collage URL").setValue(url)

        RequestPageViewController.userName?.info["Collage URL"] = url
    }
}
Dew Time
  • 818
  • 9
  • 10
  • Don't create an exact copy of your question when your [first question](https://stackoverflow.com/questions/45490817/firebase-user-authentication-not-working) was closed. Instead address the concerns in the original question. If the concern is addressed, the question can be reopened. – Frank van Puffelen Aug 03 '17 at 20:59
  • @FrankvanPuffelen Can you please reopen the question? I have addressed the concerns. – Dew Time Aug 04 '17 at 03:27
  • @FrankvanPuffelen I am sorry for annoying you. I have tried to spell out as much code as possible in my original post now. The problem is, I don't know how to reproduce the error. It seems like a random times, my images will stop downloading. And then when I try to upload a new image I get that error about not being authenticated. – Dew Time Aug 04 '17 at 03:38

0 Answers0