A Flutter plugin for authenticating users by using the native TwitterKit SDKs on Android & iOS.

Overview

flutter_twitter_login

pub package Build Status Coverage Status

A Flutter plugin for using the native TwitterKit SDKs on Android and iOS.

This plugin uses the new Gradle 4.1 and Android Studio 3.0 project setup.

Dart support

  • Dart 1: 1.0.x.
  • Dart 2: 1.1.0 and up.

Installation

See the installation instructions on pub. No platform-specific configuration is needed!

How do I use it?

Here's some sample code that should cover most of the cases. For full API reference, just see the source code. Everything is documented there.

var twitterLogin = new TwitterLogin(
  consumerKey: '<your consumer key>',
  consumerSecret: '<your consumer secret>',
);

final TwitterLoginResult result = await twitterLogin.authorize();

switch (result.status) {
  case TwitterLoginStatus.loggedIn:
    var session = result.session;
    _sendTokenAndSecretToServer(session.token, session.secret);
    break;
  case TwitterLoginStatus.cancelledByUser:
    _showCancelMessage();
    break;
  case TwitterLoginStatus.error:
    _showErrorMessage(result.error);
    break;
}
Comments
  • android app crash after adding package on flutter 2.3

    android app crash after adding package on flutter 2.3

    Hi Liro, I updated Flutter to 2.3 and the android app crashes on the startup.

    When I remove flutter_twitter_login: "^1.0.1", the app works well.

    opened by codigo47 7
  • I want to know when there are multiple CallbackURLs

    I want to know when there are multiple CallbackURLs

    Currently, we are implementing a login function using TwitterApp.

    And this TwitterApp has multiple callback urls.

    However, I did not know how to set it to use one callback url.

    Could you tell me if there are people who understand it?

    opened by lv-kit 1
  • While using this plugin it shows some error

    While using this plugin it shows some error

    A problem occurred evaluating root project 'firebase_auth'. > Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?

    Can you please find me what is the error in it

    opened by muhammednazil 0
  • sessionDataToMap might crash the plugin

    sessionDataToMap might crash the plugin

    https://github.com/roughike/flutter_twitter_login/blob/master/ios/Classes/TwitterLoginPlugin.m#L65

    It should return NSNull instead of nil. Nil can't be had as value in NSDictionary.

    opened by roughike 0
  • Improve documentation for currentSession getter

    Improve documentation for currentSession getter

    This line:

    This could be useful for logging in the user automatically in the case where you don't persist the session in your Flutter app yourself.

    might give the users the impression that they have to persist the Twitter sessions manually by themselves. This isn't most likely the case: the Twitter SDK should remember the login.

    docs 
    opened by roughike 0
  • Migrating the plugin to the V2 embedding

    Migrating the plugin to the V2 embedding

    The plugin flutter_twitter_login uses a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs. If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

    Hello friend first thanks for sharing this library, I'm using it in my project and after updating to flutter 3 I'm getting the above warning, is there any intention to update the library to flutter 3?

    opened by KriacoesMobile 0
  • Getting null token from TwitterAuthProvider.credential method

    Getting null token from TwitterAuthProvider.credential method

    Anyone have any idea why I am getting null token from the credential method? Below is the value that I get from the method.

    TwitterAuth= AuthCredential(providerId: twitter.com, signInMethod: twitter.com, token: null)

    Any help will be appreciated.

    Thanks!

    opened by hpatel32 0
  • Login goes through webview instead of app?

    Login goes through webview instead of app?

    As the title says, I can't get this package to open the Twitter app and run the login flow through there even though it's installed. Is anyone else experiencing this issue?

    I tried it on the main repo (this one) and also on a fork (https://github.com/sabreys/flutter_twitter_login) and both have the same behavior - just wondering if I'm missing something as the docs on TwitterLogin.authorize() say the following:

    /// Logs the user in. /// /// If the user has a native Twitter client installed, this will present a /// native login screen. Otherwise a WebView is used.

    opened by rvbiljouw 0
  • After login state not returning to app

    After login state not returning to app

    Hi, I configured the app as per docs but it's not working properly after login it's not showing user details instead it's showing this page: https://imgur.com/XdW82TU

    Here's my flutter doctor:

    flutter doctor -v [✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.1 19B88 darwin-x64, locale en-GB) • Flutter version 2.2.3 at /Users/mamun/Developer/flutter • Framework revision f4abaa0735 (9 days ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4

    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/mamun/Library/Android/sdk/ • Platform android-30, build-tools 30.0.2 • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/bin/java • Java version Java(TM) SE Runtime Environment (build 1.8.0_231-b11) • All Android licenses accepted.

    [!] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C505 ✗ Xcode 11.3.1 out of date (12.0.1 is recommended). Download the latest version or update via the Mac App Store. ! CocoaPods 1.9.1 out of date (1.10.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

    [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

    [!] Android Studio • Android Studio at /path/to/android/studio/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart ✗ Android Studio not found at /path/to/android/studio/Contents • Try updating or re-installing Android Studio.

    [✓] VS Code (version 1.57.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.24.0

    [✓] Connected device (2 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

    ! Doctor found issues in 2 categories.

    here's my code:

    static Future signInWithTwitter( {BuildContext? context}) async { String? newMessage;

    // Create a TwitterLogin instance
    final TwitterLogin twitterLogin = new TwitterLogin(
      consumerKey: '',
      consumerSecret: '',
    );
    
    // Trigger the sign-in flow
    final TwitterLoginResult result = await twitterLogin.authorize();
    
    // Get the Logged In session
    final TwitterSession twitterSession = result.session;
    
    // Create a credential from the access token
    final twitterAuthCredential = TwitterAuthProvider.credential(
      accessToken: twitterSession.token,
      secret: twitterSession.secret,
    );
    
    // Once signed in, return the UserCredential
    UserCredential userCredential =
        await FirebaseAuth.instance.signInWithCredential(twitterAuthCredential);
    
    log('your message here');
    log('userCredential.user');
    log(userCredential.user.toString());
    User? user = userCredential.user;
    DocumentSnapshot? doc = await Globals.userRef.doc(user!.uid).get();
    if (!doc.exists) {
      Globals.userRef.doc(user!.uid).set({
        'uid': user!.uid,
        'email': user.email,
        'firstName': "firstName",
        'lastName': "lastName",
        'displayName': user!.displayName,
        'password': 'hashedPassword',
        'userName': user.email,
        'bio': Globals.loremText,
        'photoUrl': user!.photoURL,
        'phoneNumber': "phoneNumber",
        'userType': "Facebook",
        'publicUrl': "url",
        "isAdmin": false,
        'createdAt': FieldValue.serverTimestamp(),
        'updatedAt': FieldValue.serverTimestamp(),
        'lastLoggedIn': FieldValue.serverTimestamp(),
      });
    
      switch (result.status) {
        case TwitterLoginStatus.loggedIn:
          newMessage = 'User ${user.email} LoggedIn Successfully!';
          ScaffoldMessenger.of(context!).showSnackBar(
            Globals.customSnackBar(
              content: newMessage,
            ),
          );
          break;
        case TwitterLoginStatus.cancelledByUser:
          newMessage = 'Login cancelled by user.';
          ScaffoldMessenger.of(context!).showSnackBar(
            Globals.customSnackBar(
              content: newMessage,
            ),
          );
          break;
        case TwitterLoginStatus.error:
          newMessage = 'Login error: ${result.errorMessage}';
          ScaffoldMessenger.of(context!).showSnackBar(
            Globals.customSnackBar(
              content: newMessage,
            ),
          );
          break;
      }
    }
    Navigator.push(
        context!,
        MaterialPageRoute(
            builder: (context) => WelcomeScreen(
                  user: user,
                )));
    return userCredential;
    

    }

    opened by thealmamun 3
  • Bugs : with appstore release due to using of deprecated API

    Bugs : with appstore release due to using of deprecated API

    i would like to enform the users of this package that using it with flutter 1.22.5 or 1.22.6 causes installation of older version of flutter_web_view package that causes using of deprecated API called UIWebView

    Apple refusal message Screen-Shot-2021-06-19-at-6-25-28-PM

    Whats-App-Image-2021-06-17-at-7-08-08-PM

    Whats-App-Image-2021-06-17-at-7-09-30-PM

    opened by mohadel92 0
Releases(v1.1.0)
Owner
Iiro Krankka
Iiro Krankka
Tribally SDKs enable your users to create communities and bring in more people to talk about the things they love.

tribally Tribally SDKs enable your users to create communities and bring in more people to talk about the things they love. Getting Started This proje

Horum 0 Dec 28, 2021
A wrapper around our Cocoa and Java client library SDKs, providing iOS and Android support for those using Flutter and Dart.

Ably Flutter Plugin A Flutter plugin wrapping the ably-cocoa (iOS) and ably-java (Android) client library SDKs for Ably, the platform that powers sync

Ably Realtime - our client library SDKs and libraries 46 Dec 13, 2022
Flutter plugin for authenticating a user with a web service

A Flutter plugin for authenticating a user with a web service, even if the web service is run by a third party. Most commonly used with OAuth2, but can be used with any web flow that can redirect to a custom scheme.

Linus Unnebäck 170 Jan 3, 2023
Flutter widget library containing buttons for authenticating with popular social networks: Apple, Google, Facebook, Twitter and Microsoft.

Flutter Auth Buttons This library is now in maintenance mode I'm no longer actively using Flutter and don't have the time to keep this library maintai

Duncan Jones 115 Nov 3, 2022
Flutter plugin for Firebase Auth UI. Supports popular auth providers by using native SDK for Android and iOS.

firebase_auth_ui Flutter plugin of Firebase UI which allows to add login/sign-up quickly. NOTE: This plugin is under development. Please provide Feedb

Sandip Fichadiya 50 Mar 23, 2022
dna, dart native access. A lightweight dart to native super channel plugin

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.

Assuner 14 Jul 11, 2022
Ali Türkay AVCI 1 Jan 20, 2022
Github-search - Allows users to search users on github Uses flutter

Github Search Github Search is a cross-platform mobile application powered by Flutter Framework and Github API. The application was built with simplic

Saul 3 Sep 13, 2022
Breathe is a mental health blogging app where users can join communities of doctors and other users from around the world and both share their problems as well as lend a ear to and help others

?????????????? ?????????????? In a condensed, suffocating society you can feel closed off, when you can't process your emotions and are going through

Soham Sen 3 May 16, 2022
This is a flutter based project. It authorize the user by scanning fingerprint using ios and android native fingerprint scanners.

flutter_fingerprint_auth Fingerprint Authentication in Flutter Introduction In this article we are talking about fingerprint authentication. As far as

Vnnovate Solutions Pvt Ltd 1 Aug 22, 2022
how to Integrating facebook audience network to flutter app for banner, interstitial, rewarded, native and native banner

fb_ads_flutter_12 A new Flutter project. Getting Started Watch the complite tutorial for integrating Facebook ads into the Flutter app in our Youtube

null 4 Nov 26, 2022
Flutter native ads - Show AdMob Native Ads use PlatformView

flutter_native_ads Flutter plugin for AdMob Native Ads. Compatible with Android and iOS using PlatformView. Android iOS Getting Started Android Androi

sakebook 64 Dec 20, 2022
react-native native module for In App Purchase.

Documentation Published in website. Announcement Version 8.0.0 is currently in release candidate. The module is completely rewritten with Kotlin and S

dooboolab 2.3k Dec 31, 2022
Chat messaging app for multiple users in light/dark theme with ios/android.

Chat/Messaging App Light and Dark Theme - Flutter UI Watch it on YouTube Complete Source Code (Patreon only) Packages we are using: goole_fonts: link

null 7 Dec 3, 2022
A plugin that brings native iOS keyboard behavior to Flutter.

iKeyboard A plugin that brings native iOS keyboard behavior to Flutter. Getting Started Just put IKeyboard as MaterialApp ancestor and put IKeyboard.b

Jonny Borges 1 May 4, 2022
Klutter plugin makes it possible to write a Flutter plugin for both Android and iOS using Kotlin only.

The Klutter Framework makes it possible to write a Flutter plugin for both Android and iOS using Kotlin Multiplatform. Instead of writing platform spe

Gillian 33 Dec 18, 2022
RoomKit Flutter is a wrapper of Native Android and iOS RoomKit SDK

ZEGOCLOUD RoomKit Flutter RoomKit Flutter is a wrapper of Native Android and iOS RoomKit SDK Getting started Prerequisites Basic requirements Android

null 0 Dec 16, 2022
Learn to make beautiful, native apps for Android & iOS

name title subtitle description speaker flutter Flutter Learn to make beautiful, native apps for Android & iOS Flutter is a cross-platform, mobile dev

Akshath Jain 5 Nov 4, 2019