Skip to content

stacktiger/flutter_auth

Repository files navigation


all_plugins GitHub Workflow Status Maintained With Melos


About

flutter_auth is a family of flutter plugins that provides an interface to sign-in with social auth providers such as Twitter & GitHub. View the documentation for a full overview and usage.

How

Every plugin extends flutter_auth_core to provide a unified API making social auth integration easy.

Future<void> signIn(BuildContext context) async {
    // 1. get an auth instance for your chosen social auth provider
    // For example, Twitter
    final auth = TwitterAuth(
        clientId: 'your-client-id',
        clientSecret: 'your-client-secret',
        callbackUrl: 'your-callback-url',
    );

    // 2. call login() with your app's BuildContext as the required argument
    try {
        FlutterAuthResult resp = await auth.login(context);
        print('Successfully signed in with result $resp');
    } on FlutterAuthException catch (e) {
        switch (e.code) {
            case FlutterAuthExceptionCode.cancelled:
                print('Sign-in process was cancelled by user: ${e.toString()}');
                break;
            case FlutterAuthExceptionCode.network:
                print('A network exception was thrown: ${e.toString()}');
                break;
            case FlutterAuthExceptionCode.login:
                print(
                    'A exception occurred during an sign-in attempt: ${e.toString()}');
                break;
        }
    } catch (e) {
        print('A unexpected exception occurred during an sign-in attempt $e');
    }
}

Plugins

Table of contents:


twitter_auth

Twitter Auth provides an interface to Twitter's OAuth Log In flow to authenticate a user.

[View Source]

Platform Support

Android iOS MacOS Web
✔️ ✔️ x x

github_auth

GitHub Auth provides an interface to GitHub's OAuth Log in flow to authenticate a user.

[View Source]

Platform Support

Android iOS MacOS Web
✔️ ✔️ x x

Issues

Please file flutter_auth specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to flutter_auth can be filed in the Flutter issue tracker.

Maintainers

This repository is maintained by StackTiger 🐯