Microservice for verifying Firebase ID tokens obtained after authentication via Firebase Authentication. Used as a separate component for other services that need to verify the user's authenticity.
- Clone repository:
git clone https://github.com/printHelloworldd/jwt_verification.git
cd jwt_verification- Install dependencies:
dart pub get- Run:
dart run bin/server.dartIn the root of the project, create a .env file and set the following variables
WEB_API_KEY = your_web_api_key
- WEB_API_KEY — It can be found in the Firebase console.
⚠️ Important:
Never commit
.envto repository.Make sure
.envis in.gitignore.
curl -X POST http://localhost:8080/verify-jwt \
-H "Content-Type: application/json" \
-d '{
"idToken": "sender id token"
"senderUserId": "sender user id"
}'-
idToken- The user ID token obtained via Firebase Authentication is passed here. -
senderUserId— Sender user ID, for validation
dotenv— for configuration from.envhttp- a package for making HTTP requests to external services.shelf- A web server and middleware framework for Dart that processes incoming HTTP requests and generates responses.shelf_router- a router on top ofshelfthat simplifies routing and handling of different HTTP endpoints.
Contribution to the development of the project is welcome! If you want to make changes:
-
Fork the repository;
-
Create a branch named
feature/feature-name; -
Make your changes;
-
Open a Pull Request.
We recommend discussing the idea via Issues beforehand.