@planarithm/auth
v0.1.0
Published
Shared Planarithm SSO + entitlement gate for child tools hosted on *.planarithm.com.
Maintainers
Readme
@planarithm/auth
Shared login + entitlement gate for Planarithm child tools hosted on subdomains of planarithm.com.
Install
bun add @planarithm/auth @supabase/supabase-jsUse
In your app root (e.g. src/App.tsx):
import { useEffect } from "react";
import { requireToolAccess } from "@planarithm/auth";
export default function App() {
useEffect(() => { requireToolAccess("your-tool-slug"); }, []);
// ...
}- Signed-out users are redirected to
https://www.planarithm.com/login. - Signed-in users without an entitlement are redirected to
/pricing. - Admins bypass the entitlement check.
Requirements
- Child tool served over HTTPS on a subdomain of
planarithm.com(e.g.xer-insight.planarithm.com) so the SSO cookie is visible. - A matching row in
tool_catalogwith the sameidas the slug you pass.
Build
bun install
bun run buildPublish
npm login
npm publish --access public