twitter_webview_auth 0.2.0 copy "twitter_webview_auth: ^0.2.0" to clipboard
twitter_webview_auth: ^0.2.0 copied to clipboard

Twitter oauth1 webview authentication implemention using webview_flutter

Twitter oauth1 webview authentication for Flutter #

pub

This Flutter package implements the 3-legged oauth authentication flow using webview_flutter.

Getting started #

  • Get access to the Twitter API and create a 'Standalone App' in the Twitter developer portal
  • Enable OAuth 1.0a for your app
  • Enter a callback url. This can be any arbitrary url or just the scheme
    • e.g. app://

Usage #

final TwitterAuthResult result = await TwitterAuth(
  consumerKey: 'your_consumer_key',
  consumerSecret: 'your_consumer_secret',
  callbackUrl: 'your_callback_url',
).authenticateWithTwitter(
  webviewNavigation: (Widget webview) => Navigator.of(context).push(
    MaterialPageRoute(
      builder: (_) => Scaffold(
        appBar: AppBar(title: const Text('Login')),
        body: webview,
      ),
    ),
  ),
);

result.when(
  success: (String token, String secret, String userId) {
    // user successfully authenticated
  },
  failure: (dynamic e, StackTrace? st) {
    // authentication failed
  },
  cancelled: () {
   // authentication has been cancelled by the user
  },
);

Additional information #

For making requests to the Twitter API, check out dart_twitter_api

0
likes
130
points
52
downloads

Publisher

unverified uploader

Weekly Downloads

Twitter oauth1 webview authentication implemention using webview_flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, freezed_annotation, oauth1, webview_flutter

More

Packages that depend on twitter_webview_auth