Git Product home page Git Product logo

polina-c / flutter-auth-ui Goto Github PK

View Code? Open in Web Editor NEW
57.0 2.0 18.0 295 KB

flutter-auth-ui is an authentication library for flutter web applications. It uses Firebase auth as security as a service (SECaaS) provider. It implements UI to register user, validate email, sign in, sign out, restore password, access firestore..

Home Page: https://flatter-auth-ui-demo1.codemagic.app/#/

License: Apache License 2.0

Dart 98.51% HTML 1.49%
flutter flutter-web firebase-auth authentication firestore access-firestore firebase registers-users

flutter-auth-ui's Introduction

flutter-auth-ui (faui)

faui is an authentication UI for Flutter. It registers users with email and password using Firebase security as a service ( SECaaS ). The library provides UI to register user, validate email, sign in, sign out and restore password. Supports silent sign in and access to Firestore.

Demos

Sign in on application load

Sign in on button click

Custom layout and phrasing

Use token to access Firestore

Find the source code here

Links

Pub package

Demo source code

Package source code

Usage

Create Project in Firebase

If you want to test the library, use the demo project:

apiKey: "AIzaSyA3hshWKqeogfYiklVCCtDaWJW8TfgWgB4"

To create your own Firebase project:

  1. Sign in to firebase console https://console.firebase.google.com/
  2. Add, configure and open project
  3. In the project open tab "Authentication" and then tab "Sign-in Method"
  4. Click "Email/Password", set "Enable" and click "Save"
  5. Select "Project Settings" (gear icon)
  6. Copy your "Web API Key"

Set Dependency

Update pubspec.yaml to make sure your project references necessary packages:

dependencies:
  ...
  faui: <latest version>

Check <latest version> here.

Update Code

In the beginning of the method build of the widget that requires authentication (it should be stateful), add the code:

if (fauiUser == null) {
  return fauiBuildAuthScreen(
    onExit: this.setState((){...}),
    firebaseApiKey: "...",
  );
}

Import you need:

import 'package:faui/faui.dart';

Get user email:

fauiUser.email

Sign out:

fauiSignOut()

Silent sign-in:


// Before runApp:
WidgetsFlutterBinding.ensureInitialized();
await fauiTrySignInSilently(firebaseApiKey: '...');
...

// After sign in with dialog:
fauiSaveUserLocallyForSilentSignIn();

Custom Layout and Language

To customize UI and/or language, invoke fauiBuildCustomAuthScreen instead of fauiBuildAuthScreen.

See the demo for the details.

Use the Retrieved Token to Access Your Data to Firestore

Configure basic security rules for your Firestore database. Then utilize the class FauiDbAccess.

See the demo for the details.

Contribute

Run Tests

flutter pub run test

Meet Coding Style

We follow dart styling.

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.