@better-iam/react-router
v0.2.0
Published
React Router framework-mode integration for Better IAM: root middleware, guarded loaders and actions, and an IAM API resource route.
Maintainers
Readme
@better-iam/react-router
React Router (framework mode, v7.9+ / v8) integration for Better IAM:
middlewarefor the root route gives every loader and action per-request helpers and puts IAM cookies on the responseapiserves the IAM HTTP API from anapi/iam/*resource routeguardwraps loaders andactionwraps actions, with login and step-up redirects, 403data()for error boundaries, and refusals returned foruseActionData
export const iamRouter = createIamRouter(iam, { loginPath: '/login' });
// app/root.tsx
export const middleware = [iamRouter.middleware];
// app/routes/admin.tsx
export const loader = iamRouter.guard(async (args, session) => ({ name: session.identity.name }), {
authorize: { action: 'iam:identities:read' },
});Guide: docs/react-router.md. Example: examples/react-router.
