aspnet-dataprotection-db

Community

Keep ASP.NET auth cookies valid across deploys

Authorecnepsyroc-bot
Version1.0.0
Installs0

System Documentation

What problem does it solve?

ASP.NET Core DataProtection keys are stored on the filesystem by default and are regenerated after deploys on ephemeral hosts, which invalidates encrypted cookies and tokens and forces users to reauthenticate.

Core Features & Use Cases

  • Database-backed key storage: Persist DataProtection keys to a relational database (PostgreSQL or SQL Server) using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.
  • DbContext integration: Implement IDataProtectionKeyContext on your AppDbContext to host the DataProtectionKeys DbSet and let EF Core persist keys to a data_protection_keys table.
  • Deployment reliability: Prevent session and cookie invalidation on ephemeral platforms like Railway, Heroku, Azure App Service, and containerized deployments.
  • Compatibility guidance: Align EF Core and DataProtection.EntityFrameworkCore package versions and run EF migrations to create the required table.

Quick Start

Add the Microsoft.AspNetCore.DataProtection.EntityFrameworkCore package, implement IDataProtectionKeyContext on your AppDbContext, register AddDataProtection().PersistKeysToDbContext<AppDbContext>() in Program.cs, and run an EF Core migration to update the database.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: aspnet-dataprotection-db
Download link: https://github.com/ecnepsyroc-bot/Dejavara/archive/main.zip#aspnet-dataprotection-db

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.