Closed Nightfly-student closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing the issue due to inactivity. Feel free to re-open
Hello, I am using this package to sign in/up with firebase, but I am also using realtime database but the database does not allow me to use rulesets such as
{ "rules": { ".read": true, ".write": "auth.uid != null" } }
I am using this to connect:
`async void LoginLog(object sender, EventArgs e) { var authProvider = new FirebaseAuthProvider(new Firebase.Auth.FirebaseConfig(WebApi)); try { var auth = await authProvider.SignInWithEmailAndPasswordAsync(UsernameEntry.Text, PasswordEntry.Text); var content = await auth.GetFreshAuthAsync(); var serializedcontent = JsonConvert.SerializeObject(content); Preferences.Set("userSession", content.User.Email); Preferences.Set("MyFirebaseRefreshToken", serializedcontent);
and this to check if you are logged in:
async private void GetProfileInformationAndRefreshToken() { var authProvider = new FirebaseAuthProvider(new FirebaseConfig(WebApi)); try { var savedFirebaseAuth = JsonConvert.DeserializeObject<Firebase.Auth.FirebaseAuth>(Preferences.Get("MyFirebaseRefreshToken", "")); var RefreshedContent = await authProvider.RefreshAuthAsync(savedFirebaseAuth); Preferences.Set("MyFirebaseRefreshToken", JsonConvert.SerializeObject(RefreshedContent)); } catch (Exception ex) { Console.WriteLine(ex.Message); await App.Current.MainPage.DisplayAlert("Alert", "Oh no! Token expired", "Ok"); await Navigation.PushModalAsync(new LoginPage()); } }
Does anyone see a solution?
Is it mine fault or the fault of this auth.