GithubHelp home page GithubHelp logo

resourcedesign / cordova-plugin-accountkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gurisko/cordova-plugin-accountkit

0.0 4.0 0.0 14.41 MB

AccountKit Plugin for Apache Cordova which allows you to add passwordless email and SMS authentication to your app

License: MIT License

Java 10.89% Objective-C 88.09% JavaScript 1.02%

cordova-plugin-accountkit's Introduction

npm version

Cordova AccountKit Plugin

The Apache Cordova wrapper around the Facebook AccountKit.

Installation

  1. Create Facebook Developer Account
  2. Get a Facebook App ID (APP_ID)
  3. Get an AccountKit client token (CLIENT_TOKEN)
  4. Set Enable Client Access Token Flow in your app's dashboard to ON (for more information on Client Access Token Flow, see Access Tokens and Authorization Codes)
  5. To install the plugin in your app, execute the following (replace variables where necessary):
cordova plugin add cordova-plugin-accountkit --save \
   --variable APP_ID="123456789" \
   --variable APP_NAME="myApplication" \
   --variable CLIENT_TOKEN="abcdefghijklmnopqrstuvwxyz"

If you need to change your APP_ID after installation, it's recommended that you remove and then re-add the plugin as above. Note that changes to the APP_ID value in your config.xml file will not be propagated to the individual platform builds.

Android

It is recommended to add these permission to config.xml of your Cordova project to reduce the friction during the login process (more info):

<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

API

Login with an email address

AccountKitPlugin.loginWithEmail(Object options, Function success, Function failure)

Available options:

{
	defaultCountryCode: "US",
	facebookNotificationsEnabled: true,
	initialEmail: "[email protected]"
}

Available country codes can be found here.

Success function returns an Object like:

{
	accountId: "<string>",
	applicationId: "<string>",
	token: "<long string>",
	lastRefresh: 1451606400,
	refreshInterval: 2592000
}

Failure function returns an error String.

Login with a phone number

AccountKitPlugin.loginWithPhoneNumber(Object options, Function success, Function failure)

Available options:

{
	defaultCountryCode: "US",
	facebookNotificationsEnabled: true,
	initialPhoneNumber: ["420", "123456789"]
}

Available dialing codes and country codes can be found here.

Success function returns an Object like:

{
	accountId: "<string>",
	applicationId: "<string>",
	token: "<long string>",
	lastRefresh: 1451606400,
	refreshInterval: 2592000
}

Failure function returns an error String.

Logout

AccountKitPlugin.logout()

Get account

AccountKitPlugin.getAccount(Function success, Function failure)

Success function returns an Object like:

{
	accountId: "<string>",
	applicationId: "<string>",
	token: "<long string>",
	lastRefresh: 1451606400,
	refreshInterval: 2592000,
	email: "<string>",
	phoneNumber: "<string>"
}

cordova-plugin-accountkit's People

Contributors

denyo avatar gurisko avatar

Watchers

 avatar  avatar  avatar  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.