# Firebase Storage: Firebase Storage: User does not have permission to access 'images/photo.jpg'. (storage/unauthorized)

**Code:** `storage/unauthorized: User does not have permission to access` · **Category:** Google Cloud / Firebase · **Seen on:** Google Cloud, JavaScript

Firebase Security Rules for Cloud Storage denied the request for this path and user.

## Meaning

Rules decide access: check `storage.rules` for the path and condition (`request.auth != null`), make sure the user is signed in, the path matches your match block, and rules were deployed. Test in the Rules Playground. Also check that the bucket URL in the SDK matches the project.

## Common causes

- Not signed in but rules require auth
- Rules path mismatch
- Rules not deployed
- Wrong bucket in the config
- Size or content-type conditions in rules failing

## Quick fix

1. Read and fix `storage.rules`; deploy with `firebase deploy --only storage`
2. Sign in before upload/download
3. Use the Rules Playground to simulate

## Detailed fix by platform

### Firebase

1. `firebase deploy --only storage`

## Code examples

### storage.rules

```text
rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /images/{userId}/{file} {
      allow read: if true;
      allow write: if request.auth != null && request.auth.uid == userId;
    }
  }
}
```

## How to diagnose

1. **Auth** — Signed in?
2. **Rules** — Match the path?
3. **Deploy** — Latest rules?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/gcp/firebase-storage-unauthorized)
