extension-authorization

Enforce role-based access control in Motoko canisters and React front-ends.

1|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/caffeinelabs/skills --skill extension-authorization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extension-authorization
Source: https://github.com/caffeinelabs/skills/tree/main/skills/extension-authorization
Command: npx skills add https://github.com/caffeinelabs/skills --skill extension-authorization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Apps handling personal or restricted data need a reliable way to enforce who can see or modify resources. Without built‑in authorization, developers must roll their own checks, leading to security gaps.

Core Features & Use Cases

  • Role‑Based Access Control: Define admin, user, and guest roles and protect endpoints accordingly.
  • Mixin Integration: Include MixinAuthorization in your Motoko canister to automatically expose auth endpoints.
  • Frontend Hooks: Ready‑to‑use React hooks for fetching the current user profile and guarding UI components.

Quick Start

Enable role‑based access control by adding the MixinAuthorization mixin to your canister and using the provided React hook to protect authenticated routes.

Frequently Asked Questions about extension-authorization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add role-based access control to a Motoko canister?

To implement role-based access control, add the MixinAuthorization mixin to your Motoko canister to expose auth endpoints, then use the provided React hooks to guard frontend UI components and manage authentication state.

How do I protect React UI components based on user roles?

You can protect React UI components by using the provided frontend hooks to fetch the current user profile and guard rendering based on admin, user, and guest role permissions.

Why do I need role-based access control for applications handling restricted data?

Applications handling restricted data need role-based access control to reliably enforce who can view or modify resources, preventing security gaps that arise from rolling custom authorization checks.

Can I define custom roles beyond admin, user, and guest?

The Skill enforces role-based access control using predefined admin, user, and guest roles to protect backend endpoints and UI components, with no mention of custom role definitions in the metadata.

Does this authorization library work with both Motoko backends and React frontends?

Yes, this authorization solution works with both Motoko backends and React frontends by integrating the MixinAuthorization mixin for canisters and the AccessControl library with React hooks for the frontend.