Giter Site home page Giter Site logo

amrfarid140 / firebase_auth_oauth Goto Github PK

View Code? Open in Web Editor NEW
31.0 5.0 44.0 189 KB

A Flutter plugin that makes it easy to perform OAuth sign in flows using FirebaseAuth.

Home Page: https://pub.dev/packages/firebase_auth_oauth

Kotlin 16.56% Ruby 5.27% Swift 24.44% Objective-C 1.66% Dart 40.98% HTML 1.94% Shell 9.15%
flutter firebase auth oauth android ios web

firebase_auth_oauth's Introduction

firebase_auth_oauth

A Flutter plugin that makes it easy to perform OAuth sign in flows using FirebaseAuth. It also includes support for Sign in by Apple for Firebase. This plugin supports Android, iOS and Web. OAuth flows are performed by opening pop-up on top of the application to allow the user to authenticate or the native flow in the case of sign in by apple.

Usage

You need to set up Firebase for your project first before using this plugin. Instructions can be found here.

  • In your pubspec.yaml add
dependencies:
  flutter:
    sdk: flutter
  firebase_auth: ^4.1.1
  firebase_core: ^2.1.1
  firebase_auth_oauth: ^1.2.2
  • Then in your project just call

FirebaseUser user = await FirebaseAuthOAuth().openSignInFlow("A provider ID", [list of scopes], {custom parameters map});

// Sign-in by Apple example
User user = await FirebaseAuthOAuth()
          .openSignInFlow("apple.com", ["email"], {"locale": "en"});

// Or you can link an existing logged-in user
User user = await FirebaseAuthOAuth()
          .linkExistingUserWithCredentials("apple.com", ["email"], {"locale": "en"});

// Or if the OAuth credential result is needed, you can fetch provider auth result with one of the following
OAuthCredential credential = await FirebaseAuthOAuth().signInOAuth("apple.com", ["email"], {"locale": "en"});
OAuthCredential credential = await FirebaseAuthOAuth().linkWithOAuth("apple.com", ["email"], {"locale": "en"});
USer user = FirebaseAuth.instance.currentUser;

Checkout the example Widget.

Auth Providers Support

Name Supported
Apple ✅ (Android, Web & iOS 13)
Twitter
Github
Microsoft
Yahoo
Facebook 🚫

This plugin supports OAuth operations using OAuthProvider only with the exception to Sign in by Apple on iOS 13 where it uses the native AuthenticationService.

Error Handling

Below are the error codes you might receive when using this plugin

Code Meaning
FirebaseAuthError An error coming from FirebaseAuth SDK
PluginError An error coming from this plugin. e.g. Invalid arguments or null items
PlatformError An error coming from the native platform

firebase_auth_oauth's People

Contributors

amrfarid140 avatar andre-lbc avatar bgetsug avatar bw-flagship avatar camillobucciarelli avatar fabricio-godoi avatar flowhorn avatar nilsreichardt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.