authentication

Implement JWT, OAuth2, sessions, and RBAC for authentication and authorization.

1|Updated Dec 10, 2025
One-click install
npx skills add https://github.com/markus41/lobbi-design-system --skill authentication-markus41
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: authentication
Source: https://github.com/markus41/lobbi-design-system/tree/main/.claude/skills/authentication
Command: npx skills add https://github.com/markus41/lobbi-design-system --skill authentication-markus41

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python-jose, passlib, fastapi, authlib, redis-py.

What problem does it solve?

This Skill provides comprehensive capabilities for implementing secure authentication and authorization mechanisms, protecting your applications and data from unauthorized access.

Core Features & Use Cases

  • JWT Authentication: Generate, verify, and manage JSON Web Tokens for stateless authentication.
  • OAuth2 Integration: Implement OAuth2 flows for popular providers like Google and GitHub.
  • Role-Based Access Control (RBAC): Define and enforce granular permissions based on user roles.
  • Use Case: Implement JWT-based authentication for a FastAPI application, including token generation, verification, and role-based access control to secure specific endpoints.

Quick Start

Generate a JWT access token for a user with ID 'user-123' and roles 'admin', 'viewer'.

Frequently Asked Questions about authentication

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

FAQPage Schema
How do I implement JWT authentication in a FastAPI application?

JWT authentication generates secure tokens for stateless user verification. Create tokens with user identity and roles, validate them on protected endpoints using FastAPI dependencies, and reject expired or tampered tokens. This approach eliminates server-side session storage while maintaining security.

What's the best way to add role-based access control to API endpoints?

Role-based access control (RBAC) restricts endpoint access by user role. Define roles and permissions, embed them in JWT tokens, then enforce them via dependency injection on routes. FastAPI's dependency system lets you create reusable authorization checks that verify user roles before executing handlers.

Can I integrate OAuth2 with Google and GitHub for user login?

OAuth2 integration offloads authentication to third-party providers. Use authlib to handle OAuth2 flows with Google and GitHub, exchanging authorization codes for access tokens and user profile data. This reduces credential management burden while leveraging trusted identity providers.

How do I securely hash and verify user passwords?

Password hashing converts plaintext passwords into irreversible strings using passlib. Hash passwords during registration, then verify user input against stored hashes during login. This approach protects credentials if your database is compromised.

Do I need Redis for session management in authentication flows?

Redis is optional but recommended for session storage at scale. It provides fast, persistent session tracking across application instances and enables session invalidation on logout. For single-instance applications with low concurrency, in-memory storage may suffice.

What are the limitations of stateless JWT authentication?

JWT tokens cannot be revoked until expiration, making immediate logout difficult. Token payload size grows with additional claims, and you cannot store frequently changing data like permissions. Session-based approaches work better when real-time permission updates or instant logout is critical.