firebase_auth_oauth 0.1.0+6 copy "firebase_auth_oauth: ^0.1.0+6" to clipboard
firebase_auth_oauth: ^0.1.0+6 copied to clipboard

discontinuedreplaced by: firebase_auth
outdated

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.

example/lib/main.dart

import 'dart:async';

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_auth_oauth/firebase_auth_oauth.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Future<void> performSignIn() async {
    try {
      await FirebaseAuthOAuth()
          .openSignInFlow("apple.com", ["email"], {"locale": "en"});
    } on PlatformException {
      debugPrint("error logging in");
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            Center(
              child: Text('Running example'),
            ),
            Padding(
              padding: EdgeInsets.all(10),
              child: StreamBuilder(
                  initialData: null,
                  stream: FirebaseAuth.instance.onAuthStateChanged,
                  builder: (BuildContext context,
                      AsyncSnapshot<FirebaseUser> snapshot) {
                    return RaisedButton(
                      onPressed: () async {
                        if (snapshot.data != null) {
                          await FirebaseAuth.instance.signOut();
                        } else {
                          await performSignIn();
                        }
                      },
                      child: Text(snapshot.data != null ? "Logout" : "Login"),
                    );
                  }),
            )
          ],
        ),
      ),
    );
  }
}
86
likes
0
points
539
downloads

Publisher

verified publisheramryousef.me

Weekly Downloads

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.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

firebase_auth, firebase_auth_oauth_platform_interface, firebase_auth_oauth_web, firebase_core, flutter

More

Packages that depend on firebase_auth_oauth