Table of contents
FitGo is a simple fitness tracker application. It is based on the most updated Google Health Connect API. It also uses Passage by 1password for key authentication and Firebase to store the authentication data for the application's ease.
Special feature
Application flow
First comes the authentication check and if you are not logged in then you will see a button to log in.
Then if the user is logged in successfully the user will see the main home page where he/she can see his fitness data as well as the instructions for better health.
Here the user can see his/her profile information and log out from the current account.
Here is a demo of the main app screen
Behind The Scenes
We have used Passage by 1Password for PassKey authentication. Additionally, we use Firebase Authentication to manage users from Passage.
When a user registers or logs in with his/her credentials using passage, after successful authentication a check is performed on Firebase whether a user with that passage id exists or not, if not then a JWT token is generated through Firebase Admin SDK from a remote server with the passage user id and passes to the firebase custom authentication to authenticate the same user with the same email in firebase.
Here is my passage console with the 3 users -
Here is my Firebase console with the same user with the same uid from the passage user id. These accounts are created through the app authentication flow.
The code snippet is here to generate a token from the passage user id for Firebase custom authentication
app.get("/user/create/:userid", (req, res) => {
auth
.createCustomToken(req.params.userid)
.then((customToken) => {
var sendDetail = { ok: true, data: customToken };
res.send(sendDetail);
})
.catch((error) => {
var sendDetail = { ok: false, data: error };
res.send(sendDetail);
});
});
after the authentication steps, I used Google Health Connect to retrieve the data of physical activities. Health Connect is a health data provider in Android.
Tech used
Android + Kotlin
Passage by 1Password
Firebase Authentication
Node Js for Token
Fuel Library for Networking
Material 3 for design
Health Connect to get fit data
Code
The open-source code of the app is here https://github.com/JoyMajumdar2001/FitGo
Conclusion
I would thank Hashnode and 1Password for this hackathon so that I can explore these amazing techs. It will definitely help me in the future.