Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rajivnarayana/nativescript-facebook-account-kit
A {N} plugin for integrating Account Kit.
https://github.com/rajivnarayana/nativescript-facebook-account-kit
accountkit accountkit-plugin nativescript nativescript-plugin
Last synced: 23 days ago
JSON representation
A {N} plugin for integrating Account Kit.
- Host: GitHub
- URL: https://github.com/rajivnarayana/nativescript-facebook-account-kit
- Owner: rajivnarayana
- License: apache-2.0
- Created: 2018-04-29T10:45:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T02:21:27.000Z (about 2 years ago)
- Last Synced: 2024-12-04T21:36:43.632Z (about 1 month ago)
- Topics: accountkit, accountkit-plugin, nativescript, nativescript-plugin
- Language: TypeScript
- Size: 3.46 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Facebook Account Kit plugin for NativeScript (Unofficial)
This plugin is a wrapper in {N} around the native facebook's Account Kit's iOS and Android plugins.
Refer to facebook's [docs](https://developers.facebook.com/docs/accountkit/) to understand how Account Kit works and how to set it up on Facebook's developer portal.
## Installation
```shell
tns plugin add nativescript-facebook-account-kit
```### iOS
On `iOS`, Add the following to your `Info.plist` found under `/app/App_Resources/iOS` somewhere inside ``
```xml
FacebookAppID
AccountKitClientToken
CFBundleURLTypes
CFBundleURLSchemes
ak
```### Android
On `Android`, Add the following to `AndroidManifest.xml` inside the `` tag.
```xml
```Add the following as your `strings.xml` file under `app/App_Resources/Android/src/main/res/values/strings.xml`
```xml
Your App Name
Your App name
FACEBOOK_APP_ID
ACCOUNT_KIT_CLIENT_TOKEM```
#### Account Kit and Google Play Services Version
The plugin will default to [this version](https://github.com/rajivnarayana/nativescript-facebook-account-kit/blob/master/src/platforms/android/include.gradle) of the Android `play-services-auth` SDK and `account-kit-sdk` SDK.
If you need to change the versions (to for instance the latest version), you can add project ext properties `googlePlayServicesVersion` and `accountKitVersion` to `app/App_Resources/Android/app.gradle`:```
project.ext {
googlePlayServicesVersion = "+"
accountKitVersion = "+"
}
```## Usage
Initialize the plugin with the response type you seek either `AuthorizationCode` or `AccessToken`
```typescript
import { FacebookAccountKit, AccountKitResponseType } from 'nativescript-facebook-account-kit';
const facebookAccountKit = new FacebookAccountKit(AccountKitResponseType.AuthorizationCode);
```
```typescript
import { Color } from "tns-core-modules/color";const options : AccountKitOptions = {
prefillPhoneNumber : "9XXXX12345",
prefillCountryCode : "91",
defaultCountryCode : "IN",
whitelistedCountryCodes : ["IN"],
blacklistedCountryCodes : [],
enableGetACall : true,
presentAnimated : false,
enableSendToFacebook : true,
primaryColor : new Color("orange")
};
this.facebookAccountKit.loginWithPhoneNumber(options).then(authCode => {
this.authCode = authCode;
console.log(authCode);
}, error => {
this.authCode = error.message;
console.error(error);
});
```## API
| Method | Description | Return type |
| --- | --- | --- |
| loginWithPhoneNumber | Use account kit login flow with lot of options. | A promise that resolves to either authorization code or access token. |
| loginWithEmail | Use account kit email flow. | A promise that resolves to either authorization code or access token. |## License
Apache License Version 2.0, January 2004