Code Monkey home page Code Monkey logo

xffirebaseauthexample's Introduction

XFFirebaseAuthExample

Is an example of Xamarin.Forms Droid & iOS application that authenticates users via Firebase and consuming a protected .NET Core WEB API backend with Firebase OAuthToken.

Beside that you will also find examples of:

  • IOC using Autofac
  • PropertyChanged.Fody
  • Input validation
  • IValueConverter
  • Dynamically enable/disable Command with ChangeCanExecute
  • Styles

Firebase

Service Configuration

  • Sign-in and navigate to console
  • Create a new project
    • Add application for Android
      • Download google-services.json
    • Add application for iOs
      • Download GoogleService-Info.plist
  • Open Authentication section
    • Switch to "Sign-in method" tab
      • Enable "Email/Password"
    • Switch to "Users" tab
      • Add new user

.NET Core WEB API Configuration

  • In Startup.ConfigureServices(..) set the var firebaseProjectId to your firebase id project.

Mobile App Configuration

Droid

  • Add "Xamarin.Firebase.Auth" NuGet package
  • Import "google-services.json" and set the building action to "GoogleServicesJson"
    • In other words the .csproj should contain the next line: <GoogleServicesJson Include="google-services.json" />
  • Make sure that your package name is identical to the package name inside "google-services.json"
  • Add the next line of code in the MainActivity.cs OnCreate before LoadApplication:
FirebaseApp.InitializeApp(Application.Context);
  • Implement IFirebaseAuthenticator

iOS

  • Add "Xamarin.Firebase.iOS.Auth" NuGet package to iOS project
  • Import "GoogleService-Info.plist" and set the building action to "BundleResource"
  • Make sure that your bundle identifier is identical to the bundle identifier inside "GoogleService-Info.plist"
  • Add the next line of code in the AppDelegate.cs FinishedLaunching before LoadApplication:
Firebase.Core.App.Configure();
  • Implement IFirebaseAuthenticator
  • Please note that if you want to test on the iOS simulator you will have to do one extra step as described here due to a bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.