Key Benefit: Empowers developers to offer seamless and secure tool integrations to their customers, ensuring a smooth onboarding experience while prioritizing security.

Quick Start with AuthKit

Server

import { NextRequest, NextResponse } from "next/server";
import { AuthKitToken } from "@picahq/authkit-node";

export async function POST(req: NextRequest) {
  const authKitToken = new AuthKitToken(process.env.PICA_SANDBOX_API_KEY as string);
  
  const token = await authKitToken.create({
    identity: "user_123", // a meaningful identifier (i.e., userId, teamId or organizationId)
    identityType: "user" // can be either user, team or organization
  });

  return NextResponse.json(token);
}

Client

import { useAuthKit } from "@picahq/authkit";
import { Button } from "@/components/ui/button";

export function AuthKitButton() {
  const { open } = useAuthKit({
    token: {
      url: "https://api.your-company-name.com/authkit-token",
      headers: {},
    },
    onSuccess: (connection) => {},
    onError: (error) => {},
    onClose: () => {},
  });

  return (
    <Button onClick={open}>
      Connect Tools
    </Button>
  );
}

At Pica, we dogfood our own products. AuthKit powers the connection experience in Pica’s dashboard. Create a free account, navigate to the OneTool tab, click the “Create Connection” button, and voilà - you’ll see AuthKit in action!