firebase-js-rs
Unofficial Wasm bindings for Firebase JS SDKs written in Rust.
Get strted
Following example shows how to add email and password sign in to Sycamore app.
Add and initialize SDK
Install firebase-js-rs by running the following Cargo command in your project directory:
cargo add firebase-js-rs
or alternatively add the following line to your Cargo.toml:
= "0.1.1"
Then add project in the Firebase console and install JS SDKs from the CDN.
Initialize Firebase app and get reference to the authentication service
use *;
use ;
Create new user
let result = auth.create_user_with_email_and_password.await;
Sign in user
let result = auth.sign_in_with_email_and_password.await;
Observe authentication state
let callback = new;
auth.on_auth_state_changed;
callback.forget;