[PR #5604] feat: support loginHint in: linkSocialAccount & linkSocial #31712

Open
opened 2026-04-17 22:36:02 -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: mainHead: canary


📝 Commits (10+)

  • 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
  • bcd6530 Merge branch 'main' into canary
  • 55e7d9d Merge branch 'main' 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() to hint the correct provider account (e.g., email) via the authorization URL. Aligns account linking behavior with signInSocial().

  • New Features
    • Accepts loginHint and sends it as login_hint in the provider URL (client and server).
    • Docs updated with client/server examples using Tabs.
    • OpenAPI schema includes loginHint; tests verify login_hint appears in the generated URL.

Written for commit 55e7d9d9c2. 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:** `main` ← **Head:** `canary` --- ### 📝 Commits (10+) - [`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 - [`bcd6530`](https://github.com/better-auth/better-auth/commit/bcd6530e1cf00330c2cbf9ef384d38da0849fe63) Merge branch 'main' into canary - [`55e7d9d`](https://github.com/better-auth/better-auth/commit/55e7d9d9c2af0742486650d9dd489424fc32f02c) Merge branch 'main' 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()` to hint the correct provider account (e.g., email) via the authorization URL. Aligns account linking behavior with `signInSocial()`. - **New Features** - Accepts `loginHint` and sends it as `login_hint` in the provider URL (client and server). - Docs updated with client/server examples using Tabs. - OpenAPI schema includes `loginHint`; tests verify `login_hint` appears in the generated URL. <sup>Written for commit 55e7d9d9c2af0742486650d9dd489424fc32f02c. 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 22:36:02 -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#31712