HaVaNa7
HaVaNa7

Reputation: 330

Firebase storage error 403 image retrieve

With this code i would like to display user's image

where taskImg is a dictionary string

    let url = NSURL(string:taskImg!)
    let data = NSData(contentsOf:url! as URL)

    if data != nil {
        imagePicked.image = UIImage(data:data! as Data)
    }

I got:

ResponseErrorCode=403

If I print the URL, it is showing correctly, but when I used it in a browser, it gives the 403 error response.

The view controller correctly see my authenticated user.

The only way to got it working is to set rules of Firebase to doesn't require authentication but i don't want this. What seems to be wrong?

Upvotes: 1

Views: 2130

Answers (1)

Sentient Entities
Sentient Entities

Reputation: 341

There are 3 potential considerations (even if they seem obvious, they may lead you to an answer :)

  1. Are these images set up in the same account that you have your billing set up? If you put the images on Firebase storage for a different account that doesn't have billing active, you wont be able to set up the Encryption keys for testing (Settings (gear icon) > Users and permission > Encryption keys)

  2. Do you have an API key active and correctly configured? If so, can you test this via API calls?

  3. As far as what you mentioned about the user being authenticated, what do you have set up for your Sign-In Method (from the Authentication section)? Have you checked any whitelisting properties that may be needed?

Hope this helps

Upvotes: 1

Related Questions