[PR #4364] [MERGED] Revert "fix(bearer): certain sign-in endpoints won't give bearer token v2 (#4330) #5333

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4364
Author: @himself65
Created: 9/2/2025
Status: Merged
Merged: 9/2/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/09/02/max


📝 Commits (1)

  • 281cf3a Revert "fix(bearer): certain sign-in endpoints won't give bearer token v2 (#4330)"

📊 Changes

6 files changed (+2 additions, -140 deletions)

View changed files

📝 docs/content/docs/plugins/bearer.mdx (+1 -16)
📝 packages/better-auth/src/client/plugins/index.ts (+0 -1)
📝 packages/better-auth/src/plugins/bearer/bearer.test.ts (+0 -11)
packages/better-auth/src/plugins/bearer/client.ts (+0 -27)
📝 packages/better-auth/src/plugins/bearer/index.ts (+1 -80)
📝 packages/better-auth/src/test-utils/test-instance.ts (+0 -5)

📄 Description

This reverts commit 9f15d23f77.

OK, this is my second revert of this PR. I was lost in different PR contexts. It's my bad. Sorry max.

So the issue here is that you cannot access better-auth.session in a different domain.

if you can read the session cookie there is no need to have this confirmation step unless im missing something. You can just use getSession or something to get the token. The problem his describing is an issue because you cant set cookies. If you can't set cookies this solution won't work and if you can set cookies there is no need for this solution

this the situation:
social logins doesn't return a response they instead redirect so you can't use onSuccess callback
after the oauth flow is completed, they redirect with a set cookie header
since we can't use cookies (that the whole reason of using bearer plugin) we need somehow to get the cookie value (the session token)
The only way to do is to pass the token in the url as a query param


Summary by cubic

Reverts the bearer plugin changes that added a client-side confirmation flow for social sign-ins. Removes the client plugin, endpoint, and cookie logic, restoring the original bearer behavior.

  • Refactors

    • Removed bearer client plugin and its export.
    • Removed /get-bearer-token endpoint and the temporary confirmation cookie.
    • Dropped the cookieName option from the server plugin and pruned related docs and tests.
  • Migration

    • Remove bearerClient() from your createAuthClient plugins.
    • Stop using /get-bearer-token and any code that reads bearer-token-confirmation.
    • Remove any use of the cookieName option.

🔄 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/4364 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/2/2025 **Status:** ✅ Merged **Merged:** 9/2/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/09/02/max` --- ### 📝 Commits (1) - [`281cf3a`](https://github.com/better-auth/better-auth/commit/281cf3a631dcbd18f2ad40cd110bbcc12d7d12c0) Revert "fix(bearer): certain sign-in endpoints won't give bearer token v2 (#4330)" ### 📊 Changes **6 files changed** (+2 additions, -140 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/bearer.mdx` (+1 -16) 📝 `packages/better-auth/src/client/plugins/index.ts` (+0 -1) 📝 `packages/better-auth/src/plugins/bearer/bearer.test.ts` (+0 -11) ➖ `packages/better-auth/src/plugins/bearer/client.ts` (+0 -27) 📝 `packages/better-auth/src/plugins/bearer/index.ts` (+1 -80) 📝 `packages/better-auth/src/test-utils/test-instance.ts` (+0 -5) </details> ### 📄 Description This reverts commit 9f15d23f77be570723090142ee51a55596d91595. OK, this is my second revert of this PR. I was lost in different PR contexts. It's my bad. Sorry max. So the issue here is that you cannot access `better-auth.session` in a different domain. > if you can read the session cookie there is no need to have this confirmation step unless im missing something. You can just use getSession or something to get the token. The problem his describing is an issue because you cant set cookies. If you can't set cookies this solution won't work and if you can set cookies there is no need for this solution > this the situation: social logins doesn't return a response they instead redirect so you can't use onSuccess callback after the oauth flow is completed, they redirect with a set cookie header since we can't use cookies (that the whole reason of using bearer plugin) we need somehow to get the cookie value (the session token) The only way to do is to pass the token in the url as a query param <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Reverts the bearer plugin changes that added a client-side confirmation flow for social sign-ins. Removes the client plugin, endpoint, and cookie logic, restoring the original bearer behavior. - **Refactors** - Removed bearer client plugin and its export. - Removed /get-bearer-token endpoint and the temporary confirmation cookie. - Dropped the cookieName option from the server plugin and pruned related docs and tests. - **Migration** - Remove bearerClient() from your createAuthClient plugins. - Stop using /get-bearer-token and any code that reads bearer-token-confirmation. - Remove any use of the cookieName option. <!-- 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:19:09 -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#5333