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.
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');
}
}
Table of contents:
Twitter Auth provides an interface to Twitter's OAuth Log In flow to authenticate a user.
Android | iOS | MacOS | Web |
---|---|---|---|
✔️ | ✔️ | x | x |
GitHub Auth provides an interface to GitHub's OAuth Log in flow to authenticate a user.
Android | iOS | MacOS | Web |
---|---|---|---|
✔️ | ✔️ | x | x |
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.
This repository is maintained by StackTiger 🐯