Ich bin neu im Lager von Firebase. Kann mir jemand sagen, wie ich die Speicherdateien zum Lesen und Schreiben öffentlich machen kann. Der von Firebase bereitgestellte Standardcode ist unten angegeben. Welche Änderungen sollte ich vornehmen?
service firebase.storage {
match /b/image-view-b1cf5.appspot.com/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
Die Dokumentation erklärt, dass die Regel mit true ausgewertet wird, wenn kein Regelausdruck bereitgestellt wird
service firebase.storage {
match /b/image-view-b1cf5.appspot.com/o {
match /{allPaths=**} {
// Allow access by all users
allow read, write;
}
}
}
FYI: wenn Sie nur lesend öffentlich lesen möchten.
service firebase.storage {
match /b/image-view-b1cf5.appspot.com/o {
match /{allPaths=**} {
allow read;
allow write: if request.auth != null;
}
}
}
Einfach entfernen
if request.auth! = null;
service firebase.storage {
match /b/image-view-b1cf5.appspot.com/o {
match /{allPaths=**} {
// Allow access by all users
allow read, write;
}
}
}
Glückliche Kodierung
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
// Anyone can read or write to the bucket, even non-users of your app.
// Because it is shared with Google App Engine, this will also make
// files uploaded via GAE public.
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
Das Entfernen der Authentifizierungsbedingung sollte funktionieren.