【发布时间】:2018-12-22 08:32:02
【问题描述】:
我有匿名身份验证工作。
Flutter: signed in! FirebaseUser({displayName: null, providerId: Firebase, uid: 6vj0tYIQsUSjsdiJfkjid37NhKk2, providerData: [], isEmailVerified: false, email: null, photoUrl: null, isAnonymous: true})
我的规则如下
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
我一直收到这个错误
但如果我将规则更改为公开
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if true;
}
}
}
有效!
知道发生了什么吗?
这是我的代码。我找不到任何地方可以向它提供我的身份验证信息,我什至不确定是否必须这样做。
final DatabaseReference dbRef = FirebaseDatabase().reference();
final StorageReference storageRef = FirebaseStorage().ref();
final FirebaseAuth auth = FirebaseAuth.instance;
Future<void> connect() async {
this.app = await FirebaseApp.configure(
name: 'when-coin-test',
options: const FirebaseOptions(
googleAppID: '1:3739845793845:ios:9287349823487',
apiKey: 'AoijojsoafhsdiohIOSHFOSHfoiShdfoijdf',
databaseURL: 'https://when-coin-test.firebaseio.com',
storageBucket: 'gs://when-coin-test.appspot.com'
)
);
print("connected to firebase!");
this.user = await this.auth.signInAnonymously();
print("signed in! $user");
await _getAllSocialImageUrls();
print("got socialUrls! $socialUrls");
}
【问题讨论】:
-
我脑子里闪过这么多想法:我很确定 configure 是完全可选的,而且我知道您不需要多次登录。我猜您的登录在您提出请求时尚未处理。
-
不过,我确实在等待登录。他们正在成功地按顺序记录。
-
@creativecreatorormaybe不是你说配置是可选的吗?有没有显示如何在不配置的情况下进行设置的 sn-p?
标签: firebase-authentication flutter firebase-storage