flutter_slack_oauth_firebase 0.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

pub package

flutter_slack_oauth_firebase

Extension for our flutter_slack_oauth library which adds support for Firebase Authentication and Cloud Firestore.

Usage

  • To use this plugin, add flutter_slack_oauth_firebase as a dependency in your pubspec.yaml file.

  • This package depends on Firebase Auth, so be sure to follow those steps. Unlike the documentation for that package, the Google Sign-in plugin for Firebase Auth is NOT required!

  • Deploy the Firebase Functions project in the firebase folder, which is the "backend" logic that will handle the OAuth flow. You can follow the steps as specified in the Instagram Oauth Firebase Functions sample.

After succesful login

  • The resulting access token for Slack is stored in Firebase Firestore in the slackAccessToken collection under a document with the Slack UID as document id.
  • User info returned from the Slack login is stored in Firebase Firestore in the users collection under a document with the Slack UID as document id.
  • You can easily find the Slack UID for the current user after login:
FirebaseUser user = await _auth.currentUser();
print(user.uid);

Full Example

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slack_oauth_firebase/flutter_slack_oauth_firebase.dart';

void main() {
  final FirebaseAuth _auth = FirebaseAuth.instance;

  runApp(new MaterialApp(
    home: new Scaffold(
      appBar: new AppBar(
        title: new Text("Slack OAuth Example"),
      ),
      body: new Builder(
        builder: (BuildContext context) {
          return new Center(
            child: new FirebaseSlackButton(
              clientId: "XXX_CLIENT_ID_XXX",
              clientSecret: "XXX_CLIENT_SECRET_XXX",
              redirectUrl:
              "https://XXX-FIREBASE-PROJECT-XXX.firebaseapp.com/completed.html",
              firebaseUrl:
              "https://XXX-FIREBASE-PROJECT-XXX.firebaseapp.com/index.html",
              onSuccess: () async {
                // get Firebase User:
                FirebaseUser user = await _auth.currentUser();

                Scaffold.of(context).showSnackBar(new SnackBar(
                  content: new Text('Logged in with Slack ID ' + user.uid),
                ));
              },
              onFailure: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                      content: new Text('Slack Login Failed'),
                    ));
              },
              onCancelledByUser: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                      content: new Text('Slack Login Cancelled by user'),
                    ));
              },
            ),
          );
        },
      ),
    ),
  ));
}

[0.0.2] - 10 April 2018

  • Updated flutter_slack_oauth dependency to support Flutter Beta 2 (and Dart 2).

[0.0.1] - 30 March 2018

  • Initial release
  • The resulting access token is stored in Firebase Firestore in the slackAccessToken collection.
  • User info returned from the Slack login is stored in Firebase Firestore in the users collection.
  • Both collections contain documents with the Slack UID as the document name.

example/lib/main.dart

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slack_oauth_firebase/flutter_slack_oauth_firebase.dart';

void main() {
  final FirebaseAuth _auth = FirebaseAuth.instance;

  runApp(new MaterialApp(
    home: new Scaffold(
      appBar: new AppBar(
        title: new Text("Slack OAuth Example"),
      ),
      body: new Builder(
        builder: (BuildContext context) {
          return new Center(
            child: new FirebaseSlackButton(
              clientId: "XXX_CLIENT_ID_XXX",
              clientSecret: "XXX_CLIENT_SECRET_XXX",
              redirectUrl:
                  "https://XXX-FIREBASE-PROJECT-XXX.firebaseapp.com/completed.html",
              firebaseUrl:
                  "https://XXX-FIREBASE-PROJECT-XXX.firebaseapp.com/index.html",
              onSuccess: () async {
                // get Firebase User:
                FirebaseUser user = await _auth.currentUser();

                Scaffold.of(context).showSnackBar(new SnackBar(
                      content: new Text('Logged in with Slack ID ' + user.uid),
                    ));
              },
              onFailure: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                      content: new Text('Slack Login Failed'),
                    ));
              },
              onCancelledByUser: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                      content: new Text('Slack Login Cancelled by user'),
                    ));
              },
            ),
          );
        },
      ),
    ),
  ));
}

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_slack_oauth_firebase: "^0.0.2"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_slack_oauth_firebase/flutter_slack_oauth_firebase.dart';
        
Version Uploaded Documentation Archive
0.0.2 Apr 10, 2018 Go to the documentation of flutter_slack_oauth_firebase 0.0.2 Download flutter_slack_oauth_firebase 0.0.2 archive
0.0.1 Mar 30, 2018 Go to the documentation of flutter_slack_oauth_firebase 0.0.1 Download flutter_slack_oauth_firebase 0.0.1 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6
  • Flutter: 0.3.2

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
firebase_auth ^0.5.3 0.5.5
flutter 0.0.0
flutter_slack_oauth ^0.1.1 0.1.1
flutter_webview_plugin ^0.1.5 0.1.5
Transitive dependencies
async 2.0.6
charcode 1.1.1
collection 1.14.6 1.14.9
http 0.11.3+16
http_parser 3.1.1
meta 1.1.2
path 1.5.1
shared_preferences 0.4.1
sky_engine 0.0.99
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
vector_math 2.0.6
Dev dependencies
test ^0.12.0