electron-betterauth

Implement secure Electron authentication with OS-level token encryption via IPC bridge.

Updated Oct 8, 2025
One-click install
npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill electron-betterauth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: electron-betterauth
Source: https://github.com/ichabodcole/project-docs-scaffold-template/tree/main/plugins/recipes/skills/electron-betterauth
Command: npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill electron-betterauth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This recipe provides a secure authentication workflow for Electron apps by using OS-level token encryption via safeStorage and a main/renderer IPC bridge, addressing the mismatch between browser cookies and desktop app security.

Core Features & Use Cases

  • Token encryption in the main process with safeStorage
  • Secure persistence using electron-store alongside encryption
  • Minimal, restricted IPC surface exposed to the renderer and automatic token refresh

Quick Start

Integrate this recipe by wiring the secure storage service, preload bridge, and BetterAuth client, then initialize authentication during app startup.

Frequently Asked Questions about electron-betterauth

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

FAQPage Schema
How do I securely store authentication tokens in an Electron app?

Secure authentication tokens in Electron by encrypting them in the main process with OS-level safeStorage and persisting the encrypted data using electron-store. This ensures tokens remain protected across application restarts.

Why can't I rely on browser cookies for my Electron desktop authentication?

Browser cookies are unsuitable for Electron desktop authentication because desktop apps lack standard browser cookie security boundaries. Using OS-level token encryption via safeStorage with a main/renderer IPC bridge addresses this architectural mismatch securely.

How do I safely expose encrypted tokens from the main process to the renderer?

Expose encrypted tokens to the renderer by building a minimal, restricted IPC surface through a preload bridge. The main process retains ownership of the safeStorage encryption and only sends necessary data across this bridge.

Does this approach support automatic token refresh for Electron apps?

Yes, this secure workflow supports automatic token refresh for Electron apps. The main process manages the encrypted token lifecycle and refresh logic, sending updated authentication states through the IPC bridge to the renderer.

What is the best way to persist authenticated sessions across Electron app restarts?

Persist authenticated sessions across restarts by encrypting tokens with safeStorage and saving them locally with electron-store. This combination maintains secure, stateful desktop authentication without relying on web cookies.