[PR #7869] [CLOSED] feat(electron): allow quick transfer for signed-in users #33202

Closed
opened 2026-04-17 23:51:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7869
Author: @jslno
Created: 2/9/2026
Status: Closed

Base: canaryHead: 02-08-2026/electron-transfer-user


📝 Commits (8)

📊 Changes

8 files changed (+433 additions, -61 deletions)

View changed files

demo/nextjs/app/(auth)/sign-in/_components/electron.tsx (+150 -0)
📝 demo/nextjs/app/(auth)/sign-in/page.tsx (+53 -18)
📝 docs/content/docs/integrations/electron.mdx (+2 -0)
📝 packages/electron/src/error-codes.ts (+1 -0)
📝 packages/electron/src/index.ts (+65 -41)
📝 packages/electron/src/proxy.ts (+5 -0)
📝 packages/electron/src/routes.ts (+54 -2)
📝 packages/electron/test/electron.test.ts (+103 -0)

📄 Description

Upstream #7872

Summary by cubic

Enable quick transfer to the Electron app for signed-in users. Adds a POST /electron/transfer-user endpoint and a “Continue as” UI to pick active device sessions.

  • New Features

    • Added /electron/transfer-user (POST) with session middleware. Validates client_id, state, and PKCE; sets a short-lived redirect cookie; returns { redirect: true, url } when callbackURL is provided, otherwise { redirect: false, url: null }.
    • Introduced a shared handleTransfer helper, reused in OAuth init and transfer endpoints for consistent validation and cookie setup.
    • Exposed authClient.electron.transferUser on the client and mapped it in the proxy (POST).
    • Demo sign-in renders ElectronTransferUser when client_id=electron and a session exists. Lists device sessions, temporarily switches to the selected user to transfer, then restores the original session; includes a loading state.
    • New error handling: throws INVALID_CLIENT_ID when client_id mismatches.
  • Migration

    • Call authClient.electron.transferUser from the web app when a session exists. Pass the current query params; redirect to url if redirect=true.
    • Ensure client_id matches the configured Electron client ID. No breaking changes.

Written for commit adbfda3d4d. Summary will update on new commits.


🔄 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/7869 **Author:** [@jslno](https://github.com/jslno) **Created:** 2/9/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `02-08-2026/electron-transfer-user` --- ### 📝 Commits (8) - [`e61404c`](https://github.com/better-auth/better-auth/commit/e61404ca1658ce6f3ea22c125bb5d44b43eda76f) feat(electron): allow quick transfer for signed-in users - [`6444ae8`](https://github.com/better-auth/better-auth/commit/6444ae8f02eb27e54204793a005f97cd6b1d3e42) chore: update demo - [`534359f`](https://github.com/better-auth/better-auth/commit/534359f41ec79125872dbb99274f4013d02a388e) chore: cleanup - [`0b40a2f`](https://github.com/better-auth/better-auth/commit/0b40a2fcc352da935c2f58bd83dd7e0aba4647bd) chore: fix linting - [`402d8d1`](https://github.com/better-auth/better-auth/commit/402d8d1b89f685682d3bb5472f7a81628ded26bc) chore: update tests - [`8adcf24`](https://github.com/better-auth/better-auth/commit/8adcf24e48384c749496bea39f3f2a2d4825d771) chore: update docu - [`4944c6b`](https://github.com/better-auth/better-auth/commit/4944c6b1376bf1745c855a5a7460bacb1119d4db) chore: cleanup - [`adbfda3`](https://github.com/better-auth/better-auth/commit/adbfda3d4d203ab22f6218fb00b15d754475a556) chore: fix linting ### 📊 Changes **8 files changed** (+433 additions, -61 deletions) <details> <summary>View changed files</summary> ➕ `demo/nextjs/app/(auth)/sign-in/_components/electron.tsx` (+150 -0) 📝 `demo/nextjs/app/(auth)/sign-in/page.tsx` (+53 -18) 📝 `docs/content/docs/integrations/electron.mdx` (+2 -0) 📝 `packages/electron/src/error-codes.ts` (+1 -0) 📝 `packages/electron/src/index.ts` (+65 -41) 📝 `packages/electron/src/proxy.ts` (+5 -0) 📝 `packages/electron/src/routes.ts` (+54 -2) 📝 `packages/electron/test/electron.test.ts` (+103 -0) </details> ### 📄 Description Upstream #7872 <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Enable quick transfer to the Electron app for signed-in users. Adds a POST /electron/transfer-user endpoint and a “Continue as” UI to pick active device sessions. - New Features - Added /electron/transfer-user (POST) with session middleware. Validates client_id, state, and PKCE; sets a short-lived redirect cookie; returns { redirect: true, url } when callbackURL is provided, otherwise { redirect: false, url: null }. - Introduced a shared handleTransfer helper, reused in OAuth init and transfer endpoints for consistent validation and cookie setup. - Exposed authClient.electron.transferUser on the client and mapped it in the proxy (POST). - Demo sign-in renders ElectronTransferUser when client_id=electron and a session exists. Lists device sessions, temporarily switches to the selected user to transfer, then restores the original session; includes a loading state. - New error handling: throws INVALID_CLIENT_ID when client_id mismatches. - Migration - Call authClient.electron.transferUser from the web app when a session exists. Pass the current query params; redirect to url if redirect=true. - Ensure client_id matches the configured Electron client ID. No breaking changes. <sup>Written for commit adbfda3d4d203ab22f6218fb00b15d754475a556. Summary will update on new commits.</sup> <!-- 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-04-17 23:51:39 -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#33202