All Projects → peerwaya → flutter_account_kit

peerwaya / flutter_account_kit

Licence: BSD-2-Clause license
A Flutter plugin that wraps the Facebook Account Kit SDK

Programming Languages

dart
5743 projects
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to flutter account kit

android-facebook-login
Demo Facebook Login Android Application
Stars: ✭ 20 (-52.38%)
Mutual labels:  facebook
facebook-video-downloader
Facebook Video Downloader Website Script written in PHP
Stars: ✭ 22 (-47.62%)
Mutual labels:  facebook
Facebook-Auto-Liker
Simple, hacky python script which uses pyautogui to like images on FB.
Stars: ✭ 26 (-38.1%)
Mutual labels:  facebook
meta-tag-gen
Generate HTML code optimal for social media, SEO, mobile. Uses web standards from Open Graph (Facebook) and Twitter to provide optimal results. Also generates social media posts.
Stars: ✭ 24 (-42.86%)
Mutual labels:  facebook
AIRFacebook-ANE
Native extension for Adobe AIR providing cross-platform API to Facebook SDK 4
Stars: ✭ 19 (-54.76%)
Mutual labels:  facebook
fb-messenger-bot-api
NodeJS Facebook Messenger API for bots to send messages and setup events to Facebook.
Stars: ✭ 29 (-30.95%)
Mutual labels:  facebook
scrap
Scrapping Facebook with JavaScript.
Stars: ✭ 25 (-40.48%)
Mutual labels:  facebook
darrrr
An SDK for the delegated recovery specfication
Stars: ✭ 43 (+2.38%)
Mutual labels:  facebook
FacebookTrackingRemoval
Browser extension that removes ads and the user interaction tracking from content on Facebook
Stars: ✭ 88 (+109.52%)
Mutual labels:  facebook
react-reactions
😲 Create custom reaction pickers and counters or use your favorites!
Stars: ✭ 34 (-19.05%)
Mutual labels:  facebook
Fb Automated Birthday Wisher
Automatically wishes your selected fb friends on their Birthday
Stars: ✭ 39 (-7.14%)
Mutual labels:  facebook
FrameBot
An open source template to kickstart your own facebook framebot!
Stars: ✭ 89 (+111.9%)
Mutual labels:  facebook
logd.me
Your personal and friendly life log!
Stars: ✭ 16 (-61.9%)
Mutual labels:  facebook
facebook totem
Totem allows you to retrieve information about ads of a facebook page , we can retrieve the number of people targeted, how much the ad cost and a lot of other information.
Stars: ✭ 51 (+21.43%)
Mutual labels:  facebook
How-To-Build-A-Chatbot
Learn to build a facebook chatbot using Python and Flask
Stars: ✭ 15 (-64.29%)
Mutual labels:  facebook
FacebookIPLists
Hourly Checked and Updated if Facebook modifies their list
Stars: ✭ 76 (+80.95%)
Mutual labels:  facebook
Skeleton
Skeleton is a Social Engineering tool attack switcher
Stars: ✭ 44 (+4.76%)
Mutual labels:  facebook
VKRdownloader
Vkrdownloader: All in one Video Downloader - Download videos from facebook twitter youtube tiktok and 1000+ other sites . YouTube downloader , facebook downloader . made by Vijay Kumar
Stars: ✭ 25 (-40.48%)
Mutual labels:  facebook
hashtag.io
Hashtag.io is a PHP based social networking website, which supports exclusive multimedia content, sharing and private or group messaging service.
Stars: ✭ 64 (+52.38%)
Mutual labels:  facebook
facebook-messenger
Go (GoLang) package for Facebook Messenger API and Chat bot
Stars: ✭ 62 (+47.62%)
Mutual labels:  facebook

flutter_account_kit

pub package Build Status Coverage Status A Flutter plugin for allowing users to authenticate with the native Android & iOS AccountKit SDKs

How do I use it?

For complete API documentation, just see the source code.

import 'package:flutter_account_kit/flutter_account_kit.dart';

FlutterAccountKit akt = new FlutterAccountKit();
LoginResult result = await akt.logInWithPhone();

switch (result.status) {
  case LoginStatus.loggedIn:
    _sendTokenToServer(result.accessToken.token);
    _showLoggedInUI();
    break;
  case LoginStatus.cancelledByUser:
    _showCancelledMessage();
    break;
  case LoginStatus.error:
    _showErrorOnUI();
    break;
}

Installation

To get things up and running, you'll have to declare a pubspec dependency in your Flutter project. Also some minimal Android & iOS specific configuration must be done, otherwise your app will crash.

On your Flutter project

See the installation instructions on pub.

Configuration

Find out your Facebook App ID and AccountKit Client Token from Facebook App's dashboard in the Facebook developer console.

Android
1. In **\/android/app/src/main/res/values/strings.xml**
  ...
  <string name="fb_app_id">YOUR_FACEBOOK_APP_ID</string>
  <string name="ak_client_token">YOUR_CLIENT_TOKEN</string>
  1. In <your project root>/android/app/src/main/AndroidManifest.xml
  ...
  <application>

      ...
      <meta-data
          android:name="com.facebook.sdk.ApplicationId"
          android:value="@string/fb_app_id" />
      <meta-data
          android:name="com.facebook.accountkit.ApplicationName"
          android:value="@string/app_name" />
      <meta-data
          android:name="com.facebook.accountkit.ClientToken"
          android:value="@string/ak_client_token" />
   </application>
   ...

This is the minimal required configuration. Take a look to the Account Kit documentation for Android for a more detailed guide.

(Optional) Exclude backup for Access Tokens on Android >= 6.0

As per this documentation, Account Kit does not support automated backup (introduced in Android 6.0). The following steps will exclude automated backup

  1. Create a file <your project root>/android/app/src/main/res/xml/backup_config.xml that contains the following:
  <?xml version="1.0" encoding="utf-8"?>
  <full-backup-content>
    <exclude domain="sharedpref" path="com.facebook.accountkit.AccessTokenManager.SharedPreferences.xml"/>
  </full-backup-content>
  1. In your AndroidManifest.xml add the following to exclude backup of Account Kit's Access Token.
  <application
    //other configurations here
    android:fullBackupContent="@xml/backup_config" // add this line
   >
iOS

Add your Facebook credentials to your project's Info.plist file

  <plist version="1.0">
    <dict>
      ...
      <key>FacebookAppID</key>
      <string>{your-app-id}</string>
      <key>AccountKitClientToken</key>
      <string>{your-account-kit-client-token}</string>
      <key>CFBundleURLTypes</key>
      <array>
        <dict>
          <key>CFBundleURLSchemes</key>
          <array>
            <string>ak{your-app-id}</string>
          </array>
        </dict>
      </array>
      ...
    </dict>
  </plist>

This is the minimal required configuration. Take a look to the Account Kit documentation for iOS for a more detailed guide.

Done!

Themes

iOS
import 'package:flutter/material.dart';
import 'package:flutter_account_kit/flutter_account_kit.dart';

final theme = AccountKitTheme(
    // Background
    backgroundColor: Color.fromARGB(255, 0, 120, 0,),
    backgroundImage: 'background.png',
    // Button
    buttonBackgroundColor: Color.fromARGB(255, 0, 153, 0),
    buttonBorderColor: Color.fromARGB(255, 0, 255, 0),
    buttonTextColor: Color.fromARGB(255, 0, 255, 0),
    // Button disabled
    buttonDisabledBackgroundColor: Color.fromARGB(255, 100, 153, 0),
    buttonDisabledBorderColor: Color.fromARGB(255, 100, 153, 0),
    buttonDisabledTextColor: Color.fromARGB(255, 100, 153, 0),
    // Header
    headerBackgroundColor: Color.fromARGB(255, 0, 153, 0),
    headerButtonTextColor: Color.fromARGB(255, 0, 153, 0),
    headerTextColor: Color.fromARGB(255, 0, 255, 0),
    // Input
    inputBackgroundColor: Color.fromARGB(255, 0, 255, 0),
    inputBorderColor: Color.hex('#ccc'),
    inputTextColor: Color(0xFFb74093),
    // Others
    iconColor: Color(0xFFFFFFFF),
    textColor: Color(0xFFb74093),
    titleColor: Color(0xFFb74093),
    // Header
    statusBarStyle: StatusBarStyle.lightStyle, // or StatusBarStyle.defaultStyle
   );
FlutterAccountKit akt = new FlutterAccountKit();
Config cfg = Config()
             ..theme = theme;
akt.configure(cfg);

To see the statusBarStyle reflected you must set the UIViewControllerBasedStatusBarAppearance property to true on your app's Info.plist file. You can do it from XCode screen shot 2016-08-02 at 11 44 07 am

Android

Check this commit to see how it's done in our sample app

  1. In your application styles.xml file (usually located in <your project root>/android/app/src/main/res/values folder) create a Theme with the following schema
<style name="LoginThemeYellow" parent="Theme.AccountKit">
    <item name="com_accountkit_primary_color">#f4bf56</item>
    <item name="com_accountkit_primary_text_color">@android:color/white</item>
    <item name="com_accountkit_secondary_text_color">#44566b</item>
    <item name="com_accountkit_status_bar_color">#ed9d00</item>

    <item name="com_accountkit_input_accent_color">?attr/com_accountkit_primary_color</item>
    <item name="com_accountkit_input_border_color">?attr/com_accountkit_primary_color</item>
</style>

See the full set of customizable fields here

  1. In your app AndroidManifest.xml file (usually under <your project root>/android/app/src/main folder) set that Theme to the AccountKitActivity
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" <-- Add this line
    ...>

    <!-- Set the AccountKitActivity theme -->
    <activity
      tools:replace="android:theme"
      android:name="com.facebook.accountkit.ui.AccountKitActivity"
      android:theme="@style/LoginThemeYellow" />

</manifest>

Troubleshooting

"A system issue occured, Please try again" when sending SMS

A. Check your FacebookAppID and AccountKitClientToken on iOS Info.plist and Android strings.xml are correct

B. If you have enabled the client access token flow in fb account kit dashboard, then responseType should be set to code when calling configure

// Configures the SDK with some options
import 'package:flutter_account_kit/flutter_account_kit.dart';

FlutterAccountKit akt = new FlutterAccountKit();
Config cfg = Config()
             ..responseType = ResponseType.code;
akt.configure(cfg);

Inspiration

This project was inspired by flutter_facebook_login and react-native-facebook-account-kit

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].