GithubHelp home page GithubHelp logo

gabo-siig / flutter_twitter_login Goto Github PK

View Code? Open in Web Editor NEW

This project forked from roughike/flutter_twitter_login

0.0 1.0 0.0 138 KB

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

License: BSD 2-Clause "Simplified" License

Java 23.29% Ruby 10.85% Objective-C 12.73% Dart 53.13%

flutter_twitter_login's Introduction

flutter_twitter

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.

Before instalation

Before you begin it is important to properly configure your application at https://apps.twitter.com/

It is important to configure the callback URLs so that everything works correctly in your application.

You will have to use the following callback URLs:

Android - twittersdk: //

iOS - twitterkit-CONSUMERKEY: //

FOR MORE INFORMATION READ: https://developer.twitter.com/en/docs/basics/developer-portal/guides/callback-urls.html

Complete Guide on

Configure Info.Plist

Twitter Kit looks for a URL scheme in the format twitterkit-, where consumerKey is your application's Twitter API key, e.g. twitterkit-dwLf79lNQfsJ.

You can find your consumer key in the Twitter app dashboard.

In your app's Info.plist, add URL Schemes by adding code below after

// Info.plist
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>twitterkit-<consumerKey></string>
    </array>
  </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>twitter</string>
    <string>twitterauth</string>
</array>

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;
}

flutter_twitter_login's People

Contributors

roughike avatar sanghavan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.