[PR #3791] [CLOSED] feat(base): add Sign in with Base plugin #5006

Closed
opened 2026-03-13 12:07:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3791
Author: @Story91
Created: 8/4/2025
Status: Closed

Base: canaryHead: feat/base-plugin


📝 Commits (1)

  • 23a18a8 feat(base): add Sign in with Base plugin

📊 Changes

9 files changed (+1104 additions, -0 deletions)

View changed files

📝 docs/components/sidebar-content.tsx (+22 -0)
docs/content/docs/plugins/base.mdx (+369 -0)
📝 packages/better-auth/src/client/plugins/index.ts (+1 -0)
packages/better-auth/src/plugins/base/README.md (+276 -0)
packages/better-auth/src/plugins/base/base.test.ts (+68 -0)
packages/better-auth/src/plugins/base/client.ts (+237 -0)
packages/better-auth/src/plugins/base/index.ts (+59 -0)
packages/better-auth/src/plugins/base/types.ts (+71 -0)
📝 packages/better-auth/src/plugins/index.ts (+1 -0)

📄 Description

This PR adds a new "Sign in with Base" authentication plugin for better-auth, providing SIWE-based authentication optimized for Base chain.

Features

  • Base Chain Integration: Optimized for Base Mainnet (chainId: 8453)
  • Base Account SDK: Uses official @base-org/account with wallet_connect method
  • SIWE Standard: Built on EIP-4361 standard, wrapping existing SIWE plugin
  • Fallback Support: Automatic fallback to standard SIWE if wallet_connect unsupported
  • TypeScript: Full type safety with proper interfaces
  • Documentation: Comprehensive docs with visual examples and React integration
  • Brand Compliance: Official SignInWithBaseButton component support

🔧 Changes

  • New Plugin: packages/better-auth/src/plugins/base/
  • Documentation: docs/content/docs/plugins/base.mdx
  • Sidebar Integration: Base logo and navigation
  • Tests: Unit tests covering server and client functionality

🧪 Testing

pnpm -F "better-auth" test -- base.test.ts
# ✅ 7/7 tests passing

📚 Usage

// Server
import { base } from "better-auth/plugins"
plugins: [base({ domain: "myapp.com" })]

// Client  
import { baseClient } from "better-auth/client/plugins"
plugins: [baseClient()]

// Sign in
await authClient.base.signInWithBase()

Checklist

  • Code follows project style guidelines
  • Self-explanatory code with minimal comments
  • TypeScript types and type safety
  • Tests added and passing
  • Documentation updated
  • No breaking changes
  • Follows CONTRIBUTING.md guidelines

Summary by cubic

Added a "Sign in with Base" authentication plugin to better-auth, supporting Base Account SDK and SIWE for seamless Base chain login with automatic fallback for unsupported wallets.

  • New Features
    • Base plugin optimized for Base Mainnet (chainId 8453) using official @base-org/account and SIWE (EIP-4361).
    • Automatic fallback to standard SIWE if wallet_connect is not supported.
    • TypeScript types, unit tests, and full documentation with React integration and brand-compliant UI examples.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3791 **Author:** [@Story91](https://github.com/Story91) **Created:** 8/4/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/base-plugin` --- ### 📝 Commits (1) - [`23a18a8`](https://github.com/better-auth/better-auth/commit/23a18a89233c32d6bd2cc8c70744aaa66605f0c7) feat(base): add Sign in with Base plugin ### 📊 Changes **9 files changed** (+1104 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/sidebar-content.tsx` (+22 -0) ➕ `docs/content/docs/plugins/base.mdx` (+369 -0) 📝 `packages/better-auth/src/client/plugins/index.ts` (+1 -0) ➕ `packages/better-auth/src/plugins/base/README.md` (+276 -0) ➕ `packages/better-auth/src/plugins/base/base.test.ts` (+68 -0) ➕ `packages/better-auth/src/plugins/base/client.ts` (+237 -0) ➕ `packages/better-auth/src/plugins/base/index.ts` (+59 -0) ➕ `packages/better-auth/src/plugins/base/types.ts` (+71 -0) 📝 `packages/better-auth/src/plugins/index.ts` (+1 -0) </details> ### 📄 Description This PR adds a new "Sign in with Base" authentication plugin for better-auth, providing SIWE-based authentication optimized for Base chain. ## ✨ Features - **Base Chain Integration**: Optimized for Base Mainnet (chainId: 8453) - **Base Account SDK**: Uses official `@base-org/account` with wallet_connect method - **SIWE Standard**: Built on EIP-4361 standard, wrapping existing SIWE plugin - **Fallback Support**: Automatic fallback to standard SIWE if wallet_connect unsupported - **TypeScript**: Full type safety with proper interfaces - **Documentation**: Comprehensive docs with visual examples and React integration - **Brand Compliance**: Official SignInWithBaseButton component support ## 🔧 Changes - **New Plugin**: `packages/better-auth/src/plugins/base/` - **Documentation**: `docs/content/docs/plugins/base.mdx` - **Sidebar Integration**: Base logo and navigation - **Tests**: Unit tests covering server and client functionality ## 🧪 Testing ```bash pnpm -F "better-auth" test -- base.test.ts # ✅ 7/7 tests passing ``` ## 📚 Usage ```typescript // Server import { base } from "better-auth/plugins" plugins: [base({ domain: "myapp.com" })] // Client import { baseClient } from "better-auth/client/plugins" plugins: [baseClient()] // Sign in await authClient.base.signInWithBase() ``` ## ✅ Checklist - [x] Code follows project style guidelines - [x] Self-explanatory code with minimal comments - [x] TypeScript types and type safety - [x] Tests added and passing - [x] Documentation updated - [x] No breaking changes - [x] Follows CONTRIBUTING.md guidelines <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added a "Sign in with Base" authentication plugin to better-auth, supporting Base Account SDK and SIWE for seamless Base chain login with automatic fallback for unsupported wallets. - **New Features** - Base plugin optimized for Base Mainnet (chainId 8453) using official `@base-org/account` and SIWE (EIP-4361). - Automatic fallback to standard SIWE if `wallet_connect` is not supported. - TypeScript types, unit tests, and full documentation with React integration and brand-compliant UI examples. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:07:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5006