Reputation: 23
can i use JWT in firebase firestore for my react app. If possible how do i use that. I know firebase have firebase auth. But just wanted to use JWT. Please detail.
Upvotes: 0
Views: 535
Reputation: 1037
React or Angular is totally independent of what authentication you use. Even if you have no authentication they don't care.
To use FireBase JWT auth, you need to,
have a front end login page to collect credentials from user
Firebase will give you Javascript necessary to call firebase from your React application, embed that code. When ever anybody visits your site, make the user put in login credentials
Through those credentials using the javascript library to firebase APIs so you get can get the token if credentials are okay
deny login to enduser if the credentails are not accepted which you can know based on the result of API (invoked using that javascript provided)
if valid token is returned, store it in session storage and use it throughout the application (token itself contains the signature) to verify if the login is legit or not.
Hope this helps
Upvotes: 2