[PR #5133] [MERGED] refactor: move oauth2 type to core #31401

Closed
opened 2026-04-17 22:16:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5133
Author: @himself65
Created: 10/6/2025
Status: Merged
Merged: 10/6/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/10/06/refactor-oauth


📝 Commits (1)

  • ceefd3e refactor: move oauth2 type to core

📊 Changes

45 files changed (+63 additions, -62 deletions)

View changed files

📝 packages/better-auth/src/api/routes/account.ts (+2 -6)
📝 packages/better-auth/src/api/routes/callback.ts (+2 -1)
📝 packages/better-auth/src/index.ts (+1 -1)
📝 packages/better-auth/src/init.ts (+1 -1)
📝 packages/better-auth/src/oauth2/client-credentials-token.ts (+1 -2)
📝 packages/better-auth/src/oauth2/create-authorization-url.ts (+1 -1)
📝 packages/better-auth/src/oauth2/index.ts (+0 -1)
📝 packages/better-auth/src/oauth2/refresh-access-token.ts (+1 -2)
📝 packages/better-auth/src/oauth2/utils.ts (+1 -1)
📝 packages/better-auth/src/oauth2/validate-authorization-code.ts (+1 -1)
📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+5 -3)
📝 packages/better-auth/src/plugins/sso/index.ts (+1 -1)
📝 packages/better-auth/src/social-providers/apple.ts (+1 -1)
📝 packages/better-auth/src/social-providers/atlassian.ts (+1 -1)
📝 packages/better-auth/src/social-providers/cognito.ts (+1 -1)
📝 packages/better-auth/src/social-providers/discord.ts (+1 -1)
📝 packages/better-auth/src/social-providers/dropbox.ts (+1 -1)
📝 packages/better-auth/src/social-providers/facebook.ts (+1 -1)
📝 packages/better-auth/src/social-providers/figma.ts (+1 -1)
📝 packages/better-auth/src/social-providers/github.ts (+1 -1)

...and 25 more files

📄 Description

Summary by cubic

Moved OAuth2 types to @better-auth/core and updated imports across better-auth. Standardizes shared types for providers/plugins with no runtime changes.

  • Refactors

    • Added core oauth2 export path and build/export configs.
    • Re-exported OAuth2 types from better-auth root.
    • Updated routes, plugins, and social providers to use types from @better-auth/core/oauth2.
    • Removed local oauth2/types export in better-auth.
  • Migration

    • Replace imports from better-auth/oauth2/types with @better-auth/core/oauth2.
    • Alternatively, import re-exported types from better-auth (e.g., import { OAuth2Tokens } from "better-auth").

🔄 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/5133 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/6/2025 **Status:** ✅ Merged **Merged:** 10/6/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/06/refactor-oauth` --- ### 📝 Commits (1) - [`ceefd3e`](https://github.com/better-auth/better-auth/commit/ceefd3e9b01edbae01067cc25b535b945324532f) refactor: move oauth2 type to core ### 📊 Changes **45 files changed** (+63 additions, -62 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/account.ts` (+2 -6) 📝 `packages/better-auth/src/api/routes/callback.ts` (+2 -1) 📝 `packages/better-auth/src/index.ts` (+1 -1) 📝 `packages/better-auth/src/init.ts` (+1 -1) 📝 `packages/better-auth/src/oauth2/client-credentials-token.ts` (+1 -2) 📝 `packages/better-auth/src/oauth2/create-authorization-url.ts` (+1 -1) 📝 `packages/better-auth/src/oauth2/index.ts` (+0 -1) 📝 `packages/better-auth/src/oauth2/refresh-access-token.ts` (+1 -2) 📝 `packages/better-auth/src/oauth2/utils.ts` (+1 -1) 📝 `packages/better-auth/src/oauth2/validate-authorization-code.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+5 -3) 📝 `packages/better-auth/src/plugins/sso/index.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/apple.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/atlassian.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/cognito.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/discord.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/dropbox.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/facebook.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/figma.ts` (+1 -1) 📝 `packages/better-auth/src/social-providers/github.ts` (+1 -1) _...and 25 more files_ </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Moved OAuth2 types to @better-auth/core and updated imports across better-auth. Standardizes shared types for providers/plugins with no runtime changes. - **Refactors** - Added core oauth2 export path and build/export configs. - Re-exported OAuth2 types from better-auth root. - Updated routes, plugins, and social providers to use types from @better-auth/core/oauth2. - Removed local oauth2/types export in better-auth. - **Migration** - Replace imports from better-auth/oauth2/types with @better-auth/core/oauth2. - Alternatively, import re-exported types from better-auth (e.g., import { OAuth2Tokens } from "better-auth"). <!-- 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 22:16:14 -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#31401