role-based-authentication

Implement role-based authentication with login, token refresh, and route guards.

1|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/Benmore-Studio/Benmore-Meridian --skill role-based-authentication
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: role-based-authentication
Source: https://github.com/Benmore-Studio/Benmore-Meridian/tree/main/skills/role-based-authentication
Command: npx skills add https://github.com/Benmore-Studio/Benmore-Meridian --skill role-based-authentication

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Implement robust role-based authentication for web frontends.

Core Features & Use Cases

  • Login, token refresh, and route protection across admin, provider, and customer roles.
  • HttpOnly cookies for secure token storage and automatic refresh to keep sessions seamless.
  • Privilege loss detection and two-layer route guards to prevent unauthorized access.

Quick Start

Install the authentication flow context and integrate role-based guards to secure admin and provider routes.

Frequently Asked Questions about role-based-authentication

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

FAQPage Schema
How do I implement role-based authentication for admin, provider, and customer roles in a web frontend?

Role-based authentication is implemented using an AuthContext that manages signIn, logout, and session state. It applies two-layer route guards to prevent unauthorized access across different user levels.

How does HttpOnly cookie based authentication work with automatic token refresh?

HttpOnly cookie based authentication stores tokens securely to prevent client-side access, while automatic token refresh intercepts expiring sessions to keep users logged in seamlessly without manual intervention.

What is the best way to secure frontend routes and detect privilege loss during a session?

Securing frontend routes against privilege loss requires two-layer route guards that verify roles on navigation and monitor active sessions. This prevents unauthorized access when user permissions change.

Can I use this RBAC approach for a single page application without external dependencies?

Yes, this RBAC approach operates without external dependencies. It uses a self-contained AuthContext with built-in token refresh and route protection to secure single page web applications.

Why does my frontend authentication session expire instead of refreshing automatically?

Automatic token refresh fails if the AuthContext is not properly configured to intercept expiring tokens. Proper setup uses HttpOnly cookies to securely store refresh tokens and maintain active sessions.