identifi-react
v1.0.1
Published
`IdentifiReact` is a React component that integrates with the Identifi service, enabling user identification and verification in your React applications with minimal setup. <br/><br/>
Readme
IdentifiReact
IdentifiReact is a React component that integrates with the Identifi service, enabling user identification and verification in your React applications with minimal setup.
🚀 Features
- Easy integration with the Identifi platform
- Customizable configuration options
- Callback hooks for success and error handling
- Supports TypeScript
📦 Installation
Install the package via npm or yarn:
npm install identifi-react
# or
yarn add identifi-react🛠️ Usage
import React from 'react';
import { IdentifiReact } from "identifi-react";
import "identifi-react/index.css"; // import "identifi-react/index.css" for the UI styling.
const App = () => {
return (
<IdentifiReact
title="Identifi"
appConfig={{
pbUrl: import.meta.env.VITE_PB_URL,
apiKey: import.meta.env.VITE_API_KEY,,
userId: "current_user_Id_here",
}}
onError={(error) => {
console.error("Identifi error:", error);
}}
onSuccess={(result) => {
console.log("Identifi success:", result);
}}
/>
);
};
export default App;⚙️ Props
| Prop | Type | Required | Description |
| ----------- | ---------- | -------- | --------------------------------------- |
| title | string | ✅ | Title displayed in the component |
| appConfig | object | ✅ | Configuration object for Identifi API |
| onError | function | ✅ | Callback for error handling |
| onSuccess | function | ✅ | Callback when the process is successful |
appConfig object
| Key | Type | Description |
| -------- | -------- | -------------------------------- |
| pbUrl | string | URL of the Identifi API endpoint |
| userId | string | Unique user identifier |
| apiKey | string | API key for authentication |
🧪 Example Response
On success, the onSuccess callback receives a result object. On failure, the onError callback is triggered with an error object.
🔧 Environment Variables
Make sure you define your environment variables in a .env file:
VITE_PB_URL="your-pb-api-url"
VITE_API_KEY="your-pb-api-key"🛠 Development
- Clone the repo.
- Run
npm installoryarn install. - Start development:
npm run dev📄 License
MIT License
