搜尋套件、儲存庫與 APP 分類

套件詳情v4.4.2

twitter_login

Flutter Twitter 登入外掛程式。用於透過 Twitter API OAuth 服務登入的程式庫

AndroidiOSmacOS
近 30 天下載
7640
喜歡數
117
Pub 分數
150

安裝套件

flutter pub add twitter_login

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 插件,透過 OAuth 實現 Twitter 登入,讓使用者能透過 Twitter 的 API 進行驗證。此外,該插件簡化了在 Android、iOS 與 macOS 平台與 Twitter 驗證服務的整合。插件安全地處理 OAuth 流程,提供存取權杖以授權應用程式互動。適合需要 Twitter 作為身分提供者之社交登入功能的應用程式。支援無縫的使用者入門與安全憑證管理。

適用情境

  • 使用 Twitter 的社交登入
  • 透過 Twitter 進行使用者驗證
  • 使用社交帳戶的應用程式入門
  • 安全的 OAuth 權杖處理
  • 跨平台 Twitter 登錄

主要特色

  • OAuth 1.0a 支持
  • Android/iOS/macOS 相容性
  • 安全的令牌管理
  • 簡單 API 結合
  • 內建錯誤處理

適合對象

  • 需要 Twitter 登錄的應用
  • 開發社交功能的開發者
  • 跨平台移動應用
  • 以身分驗證為重點的應用程式
  • 使用基於 OAuth 的身分提供者之專案

使用建議

  • 需要 Twitter 開發者帳戶
  • 需要在 Twitter 開發者門戶中進行正確的應用設定
  • 僅限 OAuth 1.0a(不支援 OAuth 2.0)
  • 取決於 Twitter API 的可用性
  • 可能需要額外的隱私政策披露

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

twitter_login

Pub Version

Flutter Twitter Login Plugin

Requirements

  • Dart sdk: ">=2.12.0-0 <3.0.0"
  • flutter: ">=1.25.0-8.1.pre"
  • Android: minSdkVersion 17 and add support for androidx
  • iOS: --ios-language swift, Xcode version >= 11

Twitter Configuration

Twitter Developer

required to create TwitterApp.
this plugin is need Callback URLs.

please register a different callback URL on Twitter Developers.

app_name://

If the API is not set to get email, email may be null. If you want to use email, turn on Request email address from users.

Android Configuration

Add intent filters for incoming links

/example/android/app/src/main/AndroidManifest.xm

You need to replace the scheme with a Callback URLs.

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <!-- Accepts URIs that begin with "example://gizmos” -->
  <!-- Registered Callback URLs in TwitterApp -->
  <data android:scheme="example"
        android:host="gizmos" /> <!-- host is option -->
</intent-filter>
Supporting the new Android plugins APIs

If you flutter created your project prior to version 1.12, you need to make sure to update your project in order to use the new Java Embedding API.
Make use you have flutter_embedding v2 enabled. Add the following code on the manifest file inside tag to enable embedding.
Flutter wiki: Upgrading pre 1.12 Android projects.

<meta-data
    android:name="flutterEmbedding"
    android:value="2" />

iOS Configuration

Add URLScheme

/example/ios/Runner/Info.plist

You need to replace the example with a Callback URLs.

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLName</key>
    <string></string>
    <key>CFBundleURLSchemes</key>
    <array>
      <!-- Registered Callback URLs in TwitterApp -->
      <string>example</string>
    </array>
  </dict>
</array>

Example code

See the example directory for a complete sample app using twitter_login.

example

Usage

To use this plugin, add twitter_login as a dependency in your pubspec.yaml file.

Example
import 'package:flutter/material.dart';
import 'package:twitter_login/twitter_login.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Twitter Login App'),
        ),
        body: Center(
          child: FlatButton(
            child: Text('Login With Twitter'),
            onPressed: () async {
              final twitterLogin = TwitterLogin(
                // Consumer API keys
                apiKey: 'xxxx',
                // Consumer API Secret keys
                apiSecretKey: 'xxxx',
                // Registered Callback URLs in TwitterApp
                // Android is a deeplink
                // iOS is a URLScheme
                redirectURI: 'example://',
              );
              final authResult = twitterLogin.login();
              switch (authResult.status) {
                case TwitterLoginStatus.loggedIn:
                  // success
                  break;
                case TwitterLoginStatus.cancelledByUser:
                  // cancel
                  break;
                case TwitterLoginStatus.error:
                  // error
                  break;
              }
            },
          ),
        ),
      ),
    );
  }
}

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案