Skip to Content

Installation

This guide covers installing the Passport Embed package and rendering the widget in your React application.

Prerequisites

Before installing, make sure you have:

If you don’t have credentials yet, follow the getting access guide to generate them.

Install the Package

Add the Passport Embed package to your project:

npm install @human.tech/passport-embed@latest

or

yarn add @human.tech/passport-embed@latest

Basic Setup

Import and render the PassportScoreWidget component:

import { PassportScoreWidget, DarkTheme } from "@human.tech/passport-embed"; const EMBED_API_KEY = "<YOUR_EMBED_API_KEY>"; const SCORER_ID = "<YOUR_SCORER_ID>"; function MyPage() { // Your wallet connection logic provides userAddress const userAddress = "0x..."; const signMessage = async (message: string): Promise<string> => { const accounts = await window.ethereum.request({ method: "eth_requestAccounts" }); return await window.ethereum.request({ method: "personal_sign", params: [message, accounts[0]] }); }; return ( <PassportScoreWidget apiKey={EMBED_API_KEY} scorerId={SCORER_ID} address={userAddress} generateSignatureCallback={signMessage} theme={DarkTheme} /> ); }

Required Props

PropDescription
apiKeyYour Embed API key from the Developer Portal
scorerIdYour Scorer ID from the Developer Portal
generateSignatureCallbackFunction to sign messages for OAuth-based stamps (see example above)

Optional Props

PropDescription
addressUser’s wallet address (if already known)
connectWalletCallbackFunction to prompt wallet connection if address isn’t provided
themeDarkTheme or LightTheme (defaults to DarkTheme)
collapseMode"shift", "overlay", or "off"

For the complete props reference, see the Component Reference.

Next Steps

Sample Application

See a complete working example:

Last updated on