/Asp.Net.MVC_Firebase-Tutorial

Asp.net MVC - Firebase Tutorial {CRUD - File Upload - Notification}

Primary LanguageJavaScript

Asp.net Mvc - Firebase Tutorial

Asp.net MVC - Firebase Tutorial {CRUD - File Upload - Notification}

Table of contents

General info

Firebase Authentication

  1. Add Nugets for Owin Security and Firebase Authentication
  2. Add Firebase Api Key for Configuration
  3. Account Controller For Signup,Login and Logoff Methods
  4. Add Models for Signup and Login
  5. Add Owin Startup Authentication class and Method
  6. Verify User from Firebase Authentication then signin user and add user info to Claim Identities

Firebase CRUD

  1. Signin with Gmail Account

  2. Create Project In Firebase

  3. Copy Secret Key for Authentication

  4. Create Realtime Database and Copy database Path (Secret Key and Database Path use to Firebase Configuration in C#)

  5. Create Asp.net MVC Project

  6. Add Firesharp nugget and Add reference in project

  7. Add Model and Controller.

  8. Firebase Configuration in Controller.

Firebase Storage

  1. Install Nuget for Firebase Storage and Auth
  2. Post file to View
  3. Firebase Storage Connection
  4. File Upload to Bucket

Screenshots

Example screenshot

Technologies

Code Examples

Show examples of usage:

 if ('serviceWorker' in navigator) {
                navigator.serviceWorker.register('../firebase-messaging-sw.js')
                    .then(function (registration) {
                        console.log("Service Worker Registered");
                        messaging.useServiceWorker(registration);
                    });
            }

            const messaging = firebase.messaging();

            messaging.requestPermission()
                .then(function () {
                    console.log("granted");
                    if (isTokenSentToServer()) {
                        console.log("already granted");
                    } else {
                        getRegtoken();
                    }
                });