Skip to main content

@privy-io/react-auth

Classes

Interfaces

Variables

VERSION

Const VERSION: string = version

Functions

PrivyProvider

PrivyProvider(props): Element

Passes the Privy authentication context to your React components.

This should wrap any components that will to use the Privy SDK via the usePrivy hook. As an example:

// At your application root (e.g. `_app.tsx` in NextJS):
import {PrivyProvider} from '@privy-io/react-auth';

<PrivyProvider appId="APP_ID_FROM_CONSOLE" onSuccess={() => console.log('Success!')}>
<Component {...pageProps} />
</PrivyProvider>

Parameters

NameType
propsPrivyProviderProps

Returns

Element


getAccessToken

getAccessToken(): Promise<string | null>

Returns

Promise<string | null>


usePrivy

usePrivy(): PrivyInterface

React Hook that allows you to manage the user's current authentication state and access their linked accounts.

You should use this hook to access the Privy SDK from within your React components and custom hooks.

Returns

PrivyInterface