[GH-ISSUE #1392] Store "label" for connected social accounts #8727

Closed
opened 2026-04-13 03:54:06 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @daveycodez on GitHub (Feb 9, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1392

Is this suited for github?

  • Yes, this is suited for github

No response

Describe the solution you'd like

When user connects multiple social accounts from the same provider, there is no way to differentiate them.

For example, connecting a Google account should set the "email" onto a new field called "label" on the accounts table.
A Discord account would set their username, or email.

This label would then be used in list-sessions to show the end user which account is connected for each provider.

Describe alternatives you've considered


Additional context

No response

Originally created by @daveycodez on GitHub (Feb 9, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1392 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. _No response_ ### Describe the solution you'd like When user connects multiple social accounts from the same provider, there is no way to differentiate them. For example, connecting a Google account should set the "email" onto a new field called "label" on the accounts table. A Discord account would set their username, or email. This label would then be used in list-sessions to show the end user which account is connected for each provider. ### Describe alternatives you've considered --- ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 03:54:06 -05:00
Author
Owner

@Kinfe123 commented on GitHub (Apr 12, 2025):

you still can use db hooks with additionalFiled.

<!-- gh-comment-id:2799019754 --> @Kinfe123 commented on GitHub (Apr 12, 2025): you still can use db hooks with additionalFiled.
Author
Owner

@daveycodez commented on GitHub (Apr 12, 2025):

@Kinfe123 It's possible to add additionalFields to the "accounts" table? It can't just be an additionalField on the "users" table since it has to be unique for each provider "account"

<!-- gh-comment-id:2799110847 --> @daveycodez commented on GitHub (Apr 12, 2025): @Kinfe123 It's possible to add additionalFields to the "accounts" table? It can't just be an additionalField on the "users" table since it has to be unique for each provider "account"
Author
Owner

@daveycodez commented on GitHub (Apr 12, 2025):

I wouldn't mark this as completed until we can list a social provider with the email they connected with for that provider, some guidance on how that would even be possible

<!-- gh-comment-id:2799154247 --> @daveycodez commented on GitHub (Apr 12, 2025): I wouldn't mark this as completed until we can list a social provider with the email they connected with for that provider, some guidance on how that would even be possible
Author
Owner

@Kinfe123 commented on GitHub (Apr 12, 2025):

initially i thought it was related to account but since the providerid is already there to distinguish each accounts and i was not so sure what you mean but that why i bring up the discussion so i must have mistaken it for 'user' .

Image
<!-- gh-comment-id:2799181091 --> @Kinfe123 commented on GitHub (Apr 12, 2025): initially i thought it was related to account but since the providerid is already there to distinguish each accounts and i was not so sure what you mean but that why i bring up the discussion so i must have mistaken it for 'user' . <img width="326" alt="Image" src="https://github.com/user-attachments/assets/e3809cbe-0fd6-4aef-afbc-a2df2823668a" />
Author
Owner

@daveycodez commented on GitHub (Apr 13, 2025):

The issue is that this does not distinguish between multiple Google accounts, nor tell you which Google account you have linked. Every other Auth provider has this, a lot of people are requesting it, so we need this feature

<!-- gh-comment-id:2799326323 --> @daveycodez commented on GitHub (Apr 13, 2025): The issue is that this does not distinguish between multiple Google accounts, nor tell you which Google account you have linked. Every other Auth provider has this, a lot of people are requesting it, so we need this feature
Author
Owner

@Kinfe123 commented on GitHub (Apr 13, 2025):

Oh you can have said this earlier man. But still seems a metadata thing that you can have it external to better auth by establishing relation with tables...better auth should not have to implement it except for some auditing that we are planning in the near future. This is not currently a priority but will batch it along with auditing or related features.

<!-- gh-comment-id:2799431693 --> @Kinfe123 commented on GitHub (Apr 13, 2025): Oh you can have said this earlier man. But still seems a metadata thing that you can have it external to better auth by establishing relation with tables...better auth should not have to implement it except for some auditing that we are planning in the near future. This is not currently a priority but will batch it along with auditing or related features.
Author
Owner

@daveycodez commented on GitHub (Apr 13, 2025):

Well we need a way to catch when a provider is connected so we can pull the label and store it. It should simply be "label" on accounts, a new string field, and each OAuth provider has a default label it can provide

<!-- gh-comment-id:2799445236 --> @daveycodez commented on GitHub (Apr 13, 2025): Well we need a way to catch when a provider is connected so we can pull the label and store it. It should simply be "label" on accounts, a new string field, and each OAuth provider has a default label it can provide
Author
Owner

@Kinfe123 commented on GitHub (Apr 13, 2025):

If this actually a thing we gonna do , we probably might introduce a hook onLink or onConnect or sth to fire of when this link happen or we might go be constructing a metadata right on the table so that we stringify more fields as well. Other than you still have a workaround to do it by extending the already existing plugin or patching those details right after the success connection.

<!-- gh-comment-id:2799470122 --> @Kinfe123 commented on GitHub (Apr 13, 2025): If this actually a thing we gonna do , we probably might introduce a hook onLink or onConnect or sth to fire of when this link happen or we might go be constructing a metadata right on the table so that we stringify more fields as well. Other than you still have a workaround to do it by extending the already existing plugin or patching those details right after the success connection.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8727