Skip to content

phess101/flutter_slack_oauth

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pub package

flutter_slack_oauth

A flutter OAuth package for Slack with a beautiful "Sign in with Slack" button.

Extensions:

Usage

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

Example

import 'package:flutter/material.dart';
import 'package:flutter_slack_oauth/flutter_slack_oauth.dart';

void main() {
  runApp(new MaterialApp(
    home: new Scaffold(
      body: new Builder(
        builder: (BuildContext context) {
          return new Center(
            child: new SlackButton(
              clientId: "XXX_CLIENT_ID_XXX",
              clientSecret: "XXX_CLIENT_SECRET_XXX",
              redirectUrl: "https://kunstmaan.github.io/flutter_slack_oauth/success.html",
              onSuccess: () async {
                String accessToken = await Token.getLocalAccessToken();
                UserList users = await slack.getUsers(accessToken);
                
                Scaffold.of(context).showSnackBar(new SnackBar(
                  content: new Text('We found ' + users.users.length.toString() + " users"),
                ));
              },
              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'),
                ));
              },
            ),
          );
        },
      ),
    ),
  ));
}

Don't want to use the bundled OAuth flow?

  • You can also provide your own custom onTap behaviour by manually importing package:flutter_slack_oauth/oauth/generic_slack_button.dart.
  • Or check out flutter_slack_oauth_firebase, where we use the generic_slack_button to integrate with Firebase Auth and Cloud Firestore.

About

A flutter OAuth package for Slack

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 77.9%
  • Ruby 14.6%
  • Objective-C 5.0%
  • Java 2.5%