1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! [Firebase](https://firebase.google.com) authentication layer for popular frameworks.
//!
//! Support:
//!
//! - [Axum](https://github.com/tokio-rs/axum)
//! - [Actix](https://github.com/actix/actix-web)
//!
//! ## Example:
//!
//! ### Actix
//!
//! ```rust
//! use actix_web::{get, middleware::Logger, web::Data, App, HttpServer, Responder};
//! use firebase_auth::{FirebaseAuth, FirebaseUser};
//!
//! #[get("/hello")]
//! async fn greet(user: FirebaseUser) -> impl Responder {
//! let email = user.email.unwrap_or("empty email".to_string());
//! format!("Hello {}!", email)
//! }
//!
//! #[get("/public")]
//! async fn public() -> impl Responder {
//! "ok"
//! }
//!
//! #[actix_web::main]
//! async fn main() -> std::io::Result<()> {
//! let firebase_auth = FirebaseAuth::new("my-project-id").await;
//!
//! let app_data = Data::new(firebase_auth);
//!
//! HttpServer::new(move || {
//! App::new()
//! .wrap(Logger::default())
//! .app_data(app_data.clone())
//! .service(greet)
//! .service(public)
//! })
//! .bind(("127.0.0.1", 8080))?
//! .run()
//! .await
//! }
//! ```
//!
//! ### Axum
//!
//! ```rust
//! use axum::{routing::get, Router};
//! use firebase_auth::{FirebaseAuth, FirebaseAuthState, FirebaseUser};
//!
//! async fn greet(user: FirebaseUser) -> String {
//! let email = user.email.unwrap_or("empty email".to_string());
//! format!("hello {}", email)
//! }
//!
//! async fn public() -> &'static str {
//! "ok"
//! }
//!
//! #[tokio::main]
//! async fn main() {
//! let firebase_auth = FirebaseAuth::new("my-project-id").await;
//!
//! let app = Router::new()
//! .route("/hello", get(greet))
//! .route("/", get(public))
//! .with_state(FirebaseAuthState { firebase_auth });
//!
//!
//! let addr = "127.0.0.1:8080";
//! let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
//!
//! axum::serve(listener, app).await.unwrap();
//! }
//! ```
//!
//!Visit [README.md](https://github.com/trchopan/firebase-auth/) for more details.
pub use FirebaseAuth;
pub use ;
pub use FirebaseAuthState;