SkillAgentSearch skills...

OnFire

Quick lIbrary for Firebase Email Auth and Database

Install / Use

/learn @sps014/OnFire
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

OnFire

Quick,Tiny ,Dirty library for Firebase Email Auth and Database Usage . Helps in quick prototyping.

OnFire 

| List | type | decriptions | | :--------: | :-: | :-: |
| Database | class | add ,insert, delete data in realtime on firebase data | | EMailAuth | class | signup,login,verify,reset password for users | | Cache | class | used to cache firebase data on device ram | | RestClient | class | A Rest Http Client with get ,put ,delete etc |

Example Usage

Read From Realtime DataBase
Database dbref = new Database("xyz.firebaseio.com");
var userName=dbref.Child("Scores").Child("highestScore").GetValue<string>();
Console.WriteLine($"user Name : {userName}");
Save in Database
int Score = 9099;
Database dbref = new Database("xyz.firebaseio.com");
dbref.Child("Scores").Child("highestScore").SaveValue(Score);
Delete from Database
Database dbref = new Database("xyz.firebaseio.com");
dbref.Child("Scores").Child("highestScore").DeleteValue();

Database Data Change Events

Database dbref = new Database("xyz.firebaseio.com");
var child = dbref.Child("Scores").Child("highestScore");
child.SubscribeDataChange<int>();
//called every time data is changed in database
 child.OnDataChange += Program_OnDataChange;

 /// when no need to get notified just Unsubscribe
 child.UnsubscribeDataChange();

Authenticated Database Operation

Database dbref = new Database("xyz.firebaseio.com");
dbref.AccessToken = AccessToken;
dbref.Child("Scores").Child("highestScore").SaveValue(UserDetail);
Sign in User
//Get Auth Key from your project on Firebase 
 EMailAuth auth = new EMailAuth(AuthKey);
 EMailAuth.User user=await auth.SignInUser(email, pass);
 var IDToken=user.IdToken;
 var userInfo =await auth.GetUser(IDToken);
 Console.WriteLine(userInfo.EmailVerified);
Sign up User
 //Get Auth Key from your project on Firebase 
 EMailAuth auth = new EMailAuth(AuthKey);
 EMailAuth.User user=await auth.SignUpUser(email, pass);
 var IDToken=user.IdToken;
 var userInfo =await auth.GetUser(IDToken);
 Console.WriteLine(userInfo.CreatedAt);

Verify Email

EMailAuth auth = new EMailAuth(AuthKey);
auth.SendVerification(idToken);

Related Skills

View on GitHub
GitHub Stars7
CategoryData
Updated4y ago
Forks0

Languages

C#

Security Score

55/100

Audited on May 21, 2021

No findings