laravel-auth

Configure Sanctum authentication and role-based authorization in Laravel 12 APIs.

Updated May 2, 2026
One-click install
npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-auth-abdallhmoukdad
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: laravel-auth
Source: https://github.com/abdallhMoukdad/laravel-agent-skills/tree/main/skills/laravel-auth
Command: npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-auth-abdallhmoukdad

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a straightforward method to integrate reliable authentication and authorization mechanisms into Laravel 12 APIs, simplifying access control.

Core Features & Use Cases

  • Authentication Setup: Installs and configures Sanctum for token and session-based login methods.
  • Authorization Policies: Guides creating policies and policies hooks for model access control, including super-admin bypasses.
  • Use Case: Implement secure route protection for user login tokens or role-based access to resources in a production-backed Laravel application.

Quick Start

Use the laravel-auth skill to set up Sanctum, define policies for your models, and restrict API routes with authentication middleware.

Frequently Asked Questions about laravel-auth

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

FAQPage Schema
How do I set up authentication in a Laravel 12 API?▼

To set up authentication in a Laravel 12 API, you install and configure Sanctum to handle token and session-based login methods, establishing secure user login tokens for your application.

What is the best way to implement role-based authorization in Laravel?▼

Role-based authorization in Laravel is implemented by creating authorization policies and policy hooks for model access control, including configuration for super-admin bypasses to manage scalable access.

How do I protect API routes with authentication middleware in Laravel?▼

You protect API routes with authentication middleware by applying route protection mechanisms to restrict access, ensuring only authenticated users with valid Sanctum tokens reach protected endpoints.

When should I use Laravel Sanctum vs policies for access control?▼

Use Laravel Sanctum for managing token and session-based authentication login, while policies handle model-specific role-based authorization and resource access control, including super-admin bypass logic.

Does this Laravel authorization approach support super-admin role bypasses?▼

Yes, the authorization policies guide includes implementing super-admin bypasses within model policy hooks, allowing scalable and privileged access control across your production-backed Laravel application.