Xamarin访问使用Nuget软件包firebaseauthentication.net的firebase实时数据库
IM在Firebase中的初学者和IM使用两个Nuget软件包FirebaseAthentication.net和firebaseadatabase.net。 IM试图写入一个受保护的Firebase实时数据库,该数据库具有看起来像这样的规则,
{
"rules": {
"users": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid"
}
}
}
}
我随机尝试了signwithoAuthasync方法,但是它会引发异常[邮件auth类型类型connot被这样使用。使用方法指定来发送电子邮件&密码身份验证]
private async void Button_Clicked(object sender, EventArgs e)
{
try
{
var authProvider = new FirebaseAuthProvider(new FirebaseConfig(webApiKey));
var savedfirebaseauth = JsonConvert.DeserializeObject<FirebaseAuth>(Preferences.Get("MyFirebaseRefreshToken", ""));
await authProvider.SignInWithOAuthAsync(FirebaseAuthType.EmailAndPassword, savedfirebaseauth.FirebaseToken);
//inserting info into the database
await firebaseClient.Child("users").Child("some uid1").PutAsync(new userinfo
{
firstName = "dtox",
secondName = "solo"
});
//clear the entry
recordData.Text = "";
}catch(Exception ex)
{
await App.Current.MainPage.DisplayAlert("Alert", ex.Message, "OK");
}
}
请求让我知道我的问题是否需要更澄清,谢谢。 Frank Van先生
im beginner in firebase and im using two nuget packages FirebaseAuthentication.net and FirebaseDatabase.net . im trying to write to a protected firebase realtime database that has a rule that look like this
{
"rules": {
"users": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid"
}
}
}
}
i randomly tryed SignInWithOAuthAsync method however it throws an Exception [ mail auth type connot be used like this. use method specifc to email & password authentication]
private async void Button_Clicked(object sender, EventArgs e)
{
try
{
var authProvider = new FirebaseAuthProvider(new FirebaseConfig(webApiKey));
var savedfirebaseauth = JsonConvert.DeserializeObject<FirebaseAuth>(Preferences.Get("MyFirebaseRefreshToken", ""));
await authProvider.SignInWithOAuthAsync(FirebaseAuthType.EmailAndPassword, savedfirebaseauth.FirebaseToken);
//inserting info into the database
await firebaseClient.Child("users").Child("some uid1").PutAsync(new userinfo
{
firstName = "dtox",
secondName = "solo"
});
//clear the entry
recordData.Text = "";
}catch(Exception ex)
{
await App.Current.MainPage.DisplayAlert("Alert", ex.Message, "OK");
}
}
pleace let me know if my question needs more Clarificatio thanks in advance.
mr Frank van
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不用担心我得到了你
dont worry i got you