React and Next integration kit

React and Next integration kit

Install Evantra Identity components and URL helpers in your own app with minimal setup.

Installation

Add Evantra Identity to your app

Use the package for React and Next apps to render sign-in/register buttons and generate safe OAuth URLs.

pnpm add @evantra/identity-react

React / Next usage

import {
  EvantraIdentityProvider,
  EvantraSignInButton,
  EvantraRegisterButton,
} from "@evantra/identity-react";

export function LoginSection() {
  return (
    <EvantraIdentityProvider
      config={{ identityWebBaseUrl: "https://identity.evantradebuckman.com" }}
    >
      <EvantraSignInButton className="btn" returnTo="/app">
        Sign in with Evantra
      </EvantraSignInButton>

      <EvantraRegisterButton className="btn" returnTo="/app">
        Create account
      </EvantraRegisterButton>
    </EvantraIdentityProvider>
  );
}

OAuth authorize helper

import {
  createEvantraAuthorizeUrl,
  createEvantraPkcePair,
} from "@evantra/identity-react";

const { verifier, challenge } = await createEvantraPkcePair();

const url = createEvantraAuthorizeUrl(
  "https://identity.evantradebuckman.com",
  {
    clientId: "your-client-id",
    redirectUri: "https://app.example.com/oauth/callback",
    codeChallenge: challenge,
    codeChallengeMethod: "S256",
    scope: "openid profile email",
    state: crypto.randomUUID(),
    nonce: crypto.randomUUID(),
  },
);

sessionStorage.setItem("evantra_pkce_verifier", verifier);
window.location.assign(url);

Integration checklist

  • - Register your OAuth client in Evantra Identity first.
  • - Use exact redirect URIs and keep client secrets server-side.
  • - Use PKCE and state/nonce values for every authorization request.
  • - Keep app-level authorization in your product, not identity.

Protected by Evantra Identity

Switch to Workspace