[PR #5604] Support loginHint in: auth.linkSocialAccount() / authClient.linkSocial() #6111

Open
opened 2026-03-13 12:48:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5604
Author: @CarrettaRiccardo
Created: 10/26/2025
Status: 🔄 Open

Base: canaryHead: canary


📝 Commits (8)

  • 01244e1 feat: add loginHint parameter to linkSocialAccount
  • b8a35ce docs: add loginHint usage examples for account linking
  • 56a2233 fix: use client/server Tab component in docs
  • 7ac9b3b fix: remove duplicate inline desc
  • c3bac63 Merge branch 'canary' into canary
  • 0423096 Merge branch 'canary' into canary
  • 5a4a80b fix: snap update
  • 6954a5a Merge branch 'canary' into canary

📊 Changes

4 files changed (+66 additions, -0 deletions)

View changed files

📝 docs/content/docs/concepts/oauth.mdx (+27 -0)
📝 packages/better-auth/src/api/routes/account.test.ts (+24 -0)
📝 packages/better-auth/src/api/routes/account.ts (+8 -0)
📝 packages/better-auth/src/plugins/open-api/__snapshots__/open-api.test.ts.snap (+7 -0)

📄 Description

Add support for loginHint property in auth.linkSocialAccount() / authClient.linkSocial().

Currently, only signInSocial() supports the loginHint property, which is appended to the returned provider url.
It allows to filter choice in provider based on a given email.

auth.linkSocialAccount() / authClient.linkSocial() should be the ones supposed to help linking accounts for an already subscribed account, therefore loginHint must be supported. signInSocial() can be currently used with the same behavior, but it has the wrong naming for the account linking use-case.

Closes #5592


Summary by cubic

Adds loginHint support to auth.linkSocialAccount() and authClient.linkSocial() so linking can suggest the correct provider account (e.g., email) via the authorization URL. Aligns account linking behavior with signInSocial().

  • New Features
    • Accepts loginHint and forwards it as login_hint to the provider URL.
    • Supported in both client and server APIs, with docs examples.
    • Adds a test verifying login_hint is present in the generated URL.

Written for commit 6954a5a931. 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/5604 **Author:** [@CarrettaRiccardo](https://github.com/CarrettaRiccardo) **Created:** 10/26/2025 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (8) - [`01244e1`](https://github.com/better-auth/better-auth/commit/01244e1143f2adfd437498983b6c1b5ad905d9b2) feat: add loginHint parameter to linkSocialAccount - [`b8a35ce`](https://github.com/better-auth/better-auth/commit/b8a35cebe4a14679c99aa4572d632a37a950f67f) docs: add loginHint usage examples for account linking - [`56a2233`](https://github.com/better-auth/better-auth/commit/56a2233412ddc729d9b7cd07adfacadcb1909bd5) fix: use client/server Tab component in docs - [`7ac9b3b`](https://github.com/better-auth/better-auth/commit/7ac9b3b0798cfc2203c47be198aba589dde64de2) fix: remove duplicate inline desc - [`c3bac63`](https://github.com/better-auth/better-auth/commit/c3bac6327c240b2cb6e74a7639b428a06e3fee7a) Merge branch 'canary' into canary - [`0423096`](https://github.com/better-auth/better-auth/commit/04230962dc933ea3f96f7f1ec28e81b4ecadb28f) Merge branch 'canary' into canary - [`5a4a80b`](https://github.com/better-auth/better-auth/commit/5a4a80bb6599abfdde2e84035157b3de17ea49f8) fix: snap update - [`6954a5a`](https://github.com/better-auth/better-auth/commit/6954a5a931d16caf197cf2794a8d85096a8a2e5f) Merge branch 'canary' into canary ### 📊 Changes **4 files changed** (+66 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/oauth.mdx` (+27 -0) 📝 `packages/better-auth/src/api/routes/account.test.ts` (+24 -0) 📝 `packages/better-auth/src/api/routes/account.ts` (+8 -0) 📝 `packages/better-auth/src/plugins/open-api/__snapshots__/open-api.test.ts.snap` (+7 -0) </details> ### 📄 Description Add support for `loginHint` property in `auth.linkSocialAccount() / authClient.linkSocial()`. Currently, only `signInSocial()` supports the `loginHint` property, which is appended to the returned provider url. It allows to filter choice in provider based on a given email. `auth.linkSocialAccount() / authClient.linkSocial()` should be the ones supposed to help linking accounts for an already subscribed account, therefore `loginHint` must be supported. `signInSocial()` can be currently used with the same behavior, but it has the wrong naming for the account linking use-case. Closes #5592 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds loginHint support to auth.linkSocialAccount() and authClient.linkSocial() so linking can suggest the correct provider account (e.g., email) via the authorization URL. Aligns account linking behavior with signInSocial(). - **New Features** - Accepts loginHint and forwards it as login_hint to the provider URL. - Supported in both client and server APIs, with docs examples. - Adds a test verifying login_hint is present in the generated URL. <sup>Written for commit 6954a5a931d16caf197cf2794a8d85096a8a2e5f. 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-03-13 12:48:06 -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#6111