PollarPollar
Getting Started

Quickstart

Install the Pollar packages and configure the provider in your React app.

Installation

npm install @pollar/core @pollar/react

Minimal setup

Wrap your app with PollarProvider and your API key:

import { PollarProvider } from '@pollar/react';

export default function App() {
  return (
    <PollarProvider apiKey="your-api-key">
      <YourApp />
    </PollarProvider>
  );
}

First login

In any component use the usePollar hook to authenticate the user:

import { usePollar } from '@pollar/react';

function LoginButton() {
  const { user, login, logout, isAuthenticated } = usePollar();

  if (isAuthenticated) {
    return (
      <div>
        <span>Hello, {user?.email}</span>
        <button onClick={() => logout()}>Sign out</button>
      </div>
    );
  }

  return (
    <button onClick={() => login('google')}>
      Continue with Google
    </button>
  );
}

Ready-to-use wallet button

Pollar includes a UI component for login/signup that supports all auth methods:

import { WalletButton } from '@pollar/react';

<WalletButton />

The WalletButton opens a modal with Google, GitHub, Email OTP, Freighter and Albedo.

Next steps

On this page

Was this helpful?