{"id":167,"date":"2025-02-20T06:41:34","date_gmt":"2025-02-20T06:41:34","guid":{"rendered":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/?p=167"},"modified":"2025-06-13T06:31:33","modified_gmt":"2025-06-13T06:31:33","slug":"firebase-configuration","status":"publish","type":"post","link":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/firebase-configuration\/","title":{"rendered":"Firebase Configuration"},"content":{"rendered":"<div class=\"nolwrap\">\n<pre class=\"wp-block-preformatted\">Estimated reading: 3 minutes<\/pre>\n\n\n\n<p>Setting up Firebase for your KiviLabs Project<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create A New Firebase Project<\/strong><\/h2>\n\n\n\n<p>1. We are creating the &#8220;Example&#8221; sample project.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"466\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_1.png\" alt=\"\" class=\"wp-image-297\" \/><\/figure>\n\n\n\n<p>2. After completing the project, you will be presented with this type of dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"474\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_2.png\" alt=\"\" class=\"wp-image-298\" \/><\/figure>\n\n\n\n<p>3. Go to the Project Settings and configure the Support Email.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"470\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_3.png\" alt=\"\" class=\"wp-image-299\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Add App With The Package Name In Firebase Console<\/strong><\/h2>\n\n\n\n<p>1. On the Firebase console, click the Android icon.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"479\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_4.png\" alt=\"\" class=\"wp-image-300\" \/><\/figure>\n\n\n\n<p>2. Enter Package Name (e.g., com.example.userApp) and click on register app.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"478\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_5.png\" alt=\"\" class=\"wp-image-301\" \/><\/figure>\n\n\n\n<p>3. After registering the app, you will receive the Google JSON file, download it and save it to the&nbsp;<strong>android\/app\/<\/strong>&nbsp;folder.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"477\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_6.png\" alt=\"\" class=\"wp-image-302\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Set Up Firebase Authentication<\/strong><\/h2>\n\n\n\n<p>1. Go to Build -&gt; Authentication tab and click on Get started.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"471\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_7.png\" alt=\"\" class=\"wp-image-303\" \/><\/figure>\n\n\n\n<p>2. Then select the Email\/Password, Google, Apple one by one and enable them.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"531\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_8.png\" alt=\"\" class=\"wp-image-304\" \/><\/figure>\n\n\n\n<p>3. Re-check if all these 3 modes of authentication are enabled or not.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"950\" height=\"328\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_9.png\" alt=\"\" class=\"wp-image-305\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Activating The Firestore Database<\/strong><\/h2>\n\n\n\n<p>1. Go to&nbsp;<strong>Build \u2192 Firestore Database<\/strong>&nbsp;tab and click on Get Started.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"472\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/Activating_Firestore_Database1.png\" alt=\"\" class=\"wp-image-747\" \/><\/figure>\n\n\n\n<p>2. When you click the Get Started button, a dialogue will appear asking you to Sand mode and Production mode. <\/p>\n\n\n\n<p>3. Change the Firestore&#8217;s rules to save the data in a database.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1362\" height=\"646\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/image-1.png\" alt=\"\" class=\"wp-image-755\" \/><\/figure>\n\n\n\n<p>Updated rules:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> rules_version = '2';<br>service cloud.firestore {<br>  match \/databases\/{database}\/documents {<br>  <br>    \/\/ Users Collection (Manages roles)<br>    match \/users\/{userId} {<br>      allow read, write: if request.auth != null &amp;&amp; request.auth.uid == userId;<br>    }<br>    <br>    \/\/ Allow collectors to manage their own location<br>    match \/collector_locations\/{appointmentId} {<br>      allow read, write: if request.auth != null;<br>    }<br>  }<br>}<\/pre>\n\n\n\n<p><strong>Note<\/strong><\/p>\n\n\n\n<p>The collector&#8217;s location is stored in Firestore and fetched in the customer app for real-time tracking. Firestore rules ensure data security and restrict access to authorized users only.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>SHA Fingerprint<\/strong><\/h2>\n\n\n\n<p><strong>INFO<\/strong><\/p>\n\n\n\n<p>SHA-1 fingerprint is a unique key generated for your PC that can be used for signing. It is important to have in the add Firebase as we are using Google Login and OTP Login, and to authorize these logins, we need a SHA Fingerprint certificate<\/p>\n\n\n\n<p>Add a SHA fingerprint to Firebase:<\/p>\n\n\n\n<p>1. Follow these steps if you didn&#8217;t initially provide a SHA certificate fingerprint for your Firebase Android app or if you need to add an additional one:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In your Project settings, go to the Your apps card.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"471\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_SHA1.png\" alt=\"\" class=\"wp-image-307\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Select the Firebase Android app to which you want to add a SHA fingerprint.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"469\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_SHA2.png\" alt=\"\" class=\"wp-image-308\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click Add fingerprint.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"466\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_SHA3.png\" alt=\"\" class=\"wp-image-309\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enter or paste the SHA fingerprint, then click Save.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"470\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_SHA4.png\" alt=\"\" class=\"wp-image-310\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to generate the SHA from Android Studio<\/strong><\/h2>\n\n\n\n<p><strong><strong>THERE ARE TWO TYPES OF SHA FINGERPRINT, RELEASE SHA FINGERPRINT, AND DEBUG SHA FINGERPRINT. HERE WE WILL SEE HOW TO GENERATE BOTH TYPES OF SHA FINGERPRINT.<\/strong><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/app-faqs\/how-to-generate-the-sha-in-android-studio\">How to generate SHA in Android studio<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Enable Firebase Notification in Mobile for Both Android and iOS<\/strong><\/h2>\n\n\n\n<p><strong>Obtain Project ID From Firebase<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click on&nbsp;<strong>Project Overview<\/strong>&nbsp;\u2192&nbsp;<strong>Project Settings<\/strong>&nbsp;\u2192&nbsp;<strong>General<\/strong><\/li>\n\n\n\n<li>In General Settings Copy the&nbsp;<strong>\u201cProject ID from Firebase\u201d<\/strong><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1882\" height=\"808\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/project_id.png\" alt=\"\" class=\"wp-image-311\" \/><\/figure>\n\n\n\n<p><strong>Obtain Firebase Service Account Json file<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click on&nbsp;<strong>&#8220;Service accounts&#8221;<\/strong>&nbsp;in the project Settings.<\/li>\n\n\n\n<li>Click on&nbsp;<strong>Generate new Private key<\/strong>&nbsp;Button and Download the service Json file.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1559\" height=\"737\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/firebase_service_json.png\" alt=\"\" class=\"wp-image-306\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Add Firebase Project ID and Service Account Json file to Admin Panel<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to the Admin Panel, select the&nbsp;<strong>&#8220;Setting&#8221;<\/strong>&nbsp;option in the left sidebar under the System section.<\/li>\n\n\n\n<li>Select&nbsp;<strong>&#8220;App Configuration Setting&#8221;<\/strong>&nbsp;and enable Firebase Notification switch.<\/li>\n\n\n\n<li>Add your Firebase Project ID and Upload your Firebase Service Account Json file and click on&nbsp;<strong>Submit<\/strong>&nbsp;Button.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1559\" height=\"737\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/02\/uploade_notification_data.png\" alt=\"\" class=\"wp-image-312\" \/><\/figure>\n\n\n\n<p><strong>INFO<\/strong><\/p>\n\n\n\n<p>If Service Account Json file upload fails due to permission issue or any other reason then,<br>\u2013 Open your backend code.<br>\u2013 Create folder with name\u00a0<strong>\u201cdata\u201d<\/strong>\u00a0inside\u00a0<strong>storage<\/strong>\u00a0\u2192\u00a0<strong>app<\/strong><br>\u2013 Place the Service Account JSON file inside the\u00a0<strong>\u201cdata\u201d<\/strong>\u00a0folder.<\/p>\n\n\n\n<p><strong>SUCCESSFULL !!<\/strong><\/p>\n\n\n\n<p><strong><em>Great! You Have Successfully Configured Firebase!<\/em><\/strong><\/p>\n\n\n\n<p><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Estimated reading: 3 minutes Setting up Firebase for your KiviLabs Project Create A New Firebase Project 1. We are creating the &#8220;Example&#8221; sample project. 2. After completing the project, you will be presented with this type of dashboard. 3. Go to the Project Settings and configure the Support Email. Add App With The Package Name [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"parent":163,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-167","post","type-post","status-publish","format-standard","hentry","category-kivilab"],"featured_image_src":null,"author_info":{"display_name":"","author_link":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/author\/"},"children":[],"_links":{"self":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/comments?post=167"}],"version-history":[{"count":22,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/167\/revisions"}],"predecessor-version":[{"id":857,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/167\/revisions\/857"}],"up":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/163"}],"wp:attachment":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/media?parent=167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/categories?post=167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/tags?post=167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}