{"id":15018073,"url":"https://github.com/peaske7/rocket-firebase-auth","last_synced_at":"2025-10-23T15:30:27.336Z","repository":{"id":62252970,"uuid":"555689306","full_name":"peaske7/rocket-firebase-auth","owner":"peaske7","description":"Firebase auth with Rocket, batteries included","archived":false,"fork":false,"pushed_at":"2024-09-28T04:38:03.000Z","size":457,"stargazers_count":8,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T21:09:49.311Z","etag":null,"topics":["auth","firebase","jwt","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peaske7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-22T04:56:00.000Z","updated_at":"2024-08-13T04:53:38.000Z","dependencies_parsed_at":"2024-01-27T15:47:37.822Z","dependency_job_id":"0973142f-a98d-45b3-bfbe-bf8f8cd4de9a","html_url":"https://github.com/peaske7/rocket-firebase-auth","commit_stats":{"total_commits":80,"total_committers":3,"mean_commits":"26.666666666666668","dds":0.1875,"last_synced_commit":"63357bf5f5b8ace70276089208f4e4385a41e537"},"previous_names":["peaske7/rocket-firebase-auth","drpoppyseed/rocket-firebase-auth"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peaske7%2Frocket-firebase-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peaske7%2Frocket-firebase-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peaske7%2Frocket-firebase-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peaske7%2Frocket-firebase-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peaske7","download_url":"https://codeload.github.com/peaske7/rocket-firebase-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237843771,"owners_count":19375201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","firebase","jwt","rust"],"created_at":"2024-09-24T19:51:24.181Z","updated_at":"2025-10-23T15:30:22.024Z","avatar_url":"https://github.com/peaske7.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rocket-firebase-auth\n\n![status](https://github.com/Drpoppyseed/rocket-firebase-auth/actions/workflows/ci.yml/badge.svg)\n[![crate](https://img.shields.io/crates/v/rocket-firebase-auth.svg)](https://crates.io/crates/rocket-firebase-auth)\n[![codecov](https://img.shields.io/codecov/c/github/DrPoppyseed/rocket-firebase-auth)](https://codecov.io/gh/DrPoppyseed/rocket-firebase-auth)\n\nFirebase Auth with Rocket, batteries included\n\n- __Tiny__: `rocket-firebase-auth` is tiny, with features allowing you to make it even tinier\n- __Does one thing well__: Encodes/decodes Firebase JWT tokens in Rocket apps, and that's it\n\n## Getting started\n\n### 1. Set Firebase service account keys as env variables\n\nIf you haven't already, create a service account in Firebase for the Rocket backend\nyou are creating. Generate a new private key and copy-paste the generated json\ninto a `firebase-credentials.json` file. It should look something like the json snippet below.\n\n```json\n{\n  \"type\": \"*********\",\n  \"project_id\": \"***********\",\n  \"private_key_id\": \"*************\",\n  \"private_key\": \"*****************\",\n  \"client_email\": \"*********\",\n  \"client_id\": \"*******\",\n  \"auth_uri\": \"********\",\n  \"token_uri\": \"********\",\n  \"auth_provider_x509_cert_url\": \"********\",\n  \"client_x509_cert_url\": \"********\"\n}\n```\n\nDon't forget to add the `firebase-credentials.json` file to your `.gitignore`.\n\n```gitignore\n# Firebase service account's secret credentials\nfirebase-credentials.json\n```\n\n### 2. Setup `FirebaseAuth` and get started\n\nAdd `rocket-firebase-auth` to your project.\n\n```toml\nrocket_firebase_auth = \"0.5\"\n```\n\nNow, you can create a `FirebaseAuth` struct by reading the json file with a helper\nfunction included with the default import.\n\n```rust\nuse rocket::{get, http::Status, routes, Build, Rocket};\nuse rocket_firebase_auth::{FirebaseAuth, FirebaseToken};\n\n// Setup the server state, which will include your FirebaseAuth instance, among\n// other things like the connection pool to your database.\nstruct ServerState {\n    auth: FirebaseAuth,\n}\n\n#[get(\"/\")]\nasync fn hello_world(token: FirebaseToken) -\u003e Status {\n    println!(\"Authentication succeeded with uid={}\", token.sub);\n    Status::Ok\n}\n\n#[rocket::launch]\nasync fn rocket() -\u003e Rocket\u003cBuild\u003e {\n    let firebase_auth = FirebaseAuth::builder()\n        .json_file(\"firebase-credentials.json\")\n        .build()\n        .unwrap();\n\n    rocket::build()\n        .mount(\"/\", routes![hello_world])\n        .manage(ServerState {\n            auth: firebase_auth,\n        })\n}\n```\n\n## Example projects\n\nFor a more detailed example with a frontend example as well, checkout the [example\nprojects](https://github.com/DrPoppyseed/rocket-firebase-auth/tree/main/examples/react-rocket-example)\n.\n\n## Testing\n\nTo run tests, run the following command:\n\n```bash\ncargo test -- --test-threads=1\n```\n\n## Contribute\n\nAny contributions (PRs, Issues) are welcomed!\n\n## Questions\n\nIf you have any questions, however trivial it may seem, please let me know via Issues. I will respond!\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeaske7%2Frocket-firebase-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeaske7%2Frocket-firebase-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeaske7%2Frocket-firebase-auth/lists"}