0.3.6 • Published 3 months ago

react-native-phyllo-connect v0.3.6

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

npm package

Configuring the SDK

In your React Native project directory:

npm install react-native-phyllo-connect

Then install iOS dependencies using cocoapods:\ Version

cd ios && pod install

React Native implementation

Importing from react-native-phyllo-connect

import PhylloConnect from 'react-native-phyllo-connect'

Creating a user and token

Create a Phyllo Connect SDK Configuration

import PhylloConnect, { PhylloEnvironment } from "react-native-phyllo-connect";

const config = {
  clientDisplayName: clientDisplayName, // the name of your app that you want the creators to see while granting access
  environment: 'sandbox', // the mode in which you want to use the SDK,  `sandbox` or `production`
  userId: userId, // the unique user_id parameter returned by Phyllo API when you create a user (see https://docs.getphyllo.com/docs/api-reference/reference/openapi.v1.yml/paths/~1v1~1users/post)
  token: token,
  workPlatformId: workPlatformId, // (optional) the unique work_platform_id of a specific work platform, if you want the creator to skip the platform selection screen and just be able to connect just with a single work platform
};

const phylloConnect = PhylloConnect.initialize(config);
ArgumentsValueType
clientDisplayNameClient Display NameString
tokenUser TokenString
userIdUser IdString
environmentEnvironmentString //'sandbox', 'production' are the valid values
workPlatformIdPlatform Id (optional)String or Null

Subscribing to events

phylloConnect.on("accountConnected", (accountId, workplatformId, userId) => {  // gives the successfully connected account ID and work platform ID for the given user ID
  console.log(`onAccountConnected: ${accountId}, ${workplatformId}, ${userId}`);
})
phylloConnect.on("accountDisconnected", (accountId, workplatformId, userId) => {  // gives the successfully disconnected account ID and work platform ID for the given user ID
  console.log(`onAccountDisconnected: ${accountId}, ${workplatformId}, ${userId}`);
})
phylloConnect.on("tokenExpired", (userId) => {  // gives the user ID for which the token has expired
  console.log(`onTokenExpired: ${userId}`);
})
phylloConnect.on("exit", (reason, userId) => {  // indicated that the user with given user ID has closed the SDK and gives an appropriate reason for it
  console.log(`onExit: ${reason}, ${userId}`);
})
phylloConnect.on("connectionFailure", (reason, workplatformId, userId) => {  // optional, Connection failure callback support : User can now add a new callback connectionFailure for tracking the reason of accounts not getting connected , this is optional callback .
  console.log(`onConnectionFailure: ${reason}, ${workplatformId}, ${userId}`);
})

Open the connection screen

phylloConnect.open();

Version Details

console.log('Version Details', phylloConnect.version())

Examples

Try our sample app

Facing any issue? We have listed solutions for some comman issues here, If it doesn't help you, feel free to raise an issue in the issues section or report your issue on #bug-reports channel of our Discord server.

Author

Phyllo, phyl@getphyllo.com

License

PhylloConnect is available under the MIT license. See the LICENSE file for more information.

0.3.6

3 months ago

0.3.6-beta.1

4 months ago

0.3.5

4 months ago

0.3.3

10 months ago

0.3.2

1 year ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.0

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago