Hiyve Components - v1.0.0
    Preparing search index...

    Function IdentityProvider

    • Provides authentication context to all child components.

      Wrap your application (or the portion that needs auth) with IdentityProvider to enable the useIdentity, useUser, useAuthState, and useAuthActions hooks.

      Parameters

      Returns Element

      Key Features:

      • Reactive auth state — components re-render when login/logout/TFA events occur
      • Automatic token refresh — tokens are refreshed before expiry (configurable)
      • Persisted sessions — survives page refreshes when using localStorage storage
      • TFA support — detects when two-factor verification is required after login
      import { IdentityProvider } from '@hiyve/react-identity';

      function App() {
      return (
      <IdentityProvider apiKey="pk_live_xxx">
      <MyApp />
      </IdentityProvider>
      );
      }
      <IdentityProvider
      apiKey="pk_test_xxx"
      environment="development"
      tokenStorage="memory"
      >
      <MyApp />
      </IdentityProvider>