Organization in user object #574

Open
opened 2026-03-13 07:53:49 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @mmikhan on GitHub (Jan 19, 2025).

Is this suited for github?

  • Yes, this is suited for github

Is your feature request related to a problem? Please describe.

There's no way to get the organization for each of the user as there's no organization object associated with the user object.

Describe the solution you'd like

Just like the organization object show the user object for each organization, we also need the organization object associated with each user:

{
    "id": "95TGZuD99WVJ",
    "name": "John Doe",
    "email": "johndoe@example.com",
    "image": "https://example.com/avatar.png",
    "organization": {
        "id": "adfdasfdasfsa",
        "organizationId": "GfKQybkLjFaAuOyav02YNUGObHhxBMFH",
        "userId": "95TGZuD99WVJ",
        "role": "member",
        "createdAt": "2025-01-18T08:29:28.225Z",
    }
}

Describe alternatives you've considered

Currently, organization object only showing the user associated with it. If we want to see the organization associated with each user from the user object, there's no way to do it unless we manually reverse the user and organization object but that's not ideal.

Additional context

This is what the organization object shows:

{
    "id": "adfdasfdasfsa",
    "organizationId": "GfKQybkLjFaAuOyav02YNUGObHhxBMFH",
    "userId": "95TGZuD99WVJ",
    "role": "member",
    "createdAt": "2025-01-18T08:29:28.225Z",
    "user": {
        "id": "95TGZuD99WVJ",
        "name": "John Doe",
        "email": "johndoe@example.com",
        "image": "https://example.com/avatar.png"
    }
}
Originally created by @mmikhan on GitHub (Jan 19, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. There's no way to get the organization for each of the user as there's no `organization` object associated with the `user` object. ### Describe the solution you'd like Just like the `organization` object show the `user` object for each organization, we also need the `organization` object associated with each `user`: ```json { "id": "95TGZuD99WVJ", "name": "John Doe", "email": "johndoe@example.com", "image": "https://example.com/avatar.png", "organization": { "id": "adfdasfdasfsa", "organizationId": "GfKQybkLjFaAuOyav02YNUGObHhxBMFH", "userId": "95TGZuD99WVJ", "role": "member", "createdAt": "2025-01-18T08:29:28.225Z", } } ``` ### Describe alternatives you've considered Currently, `organization` object only showing the `user` associated with it. If we want to see the organization associated with each user from the `user` object, there's no way to do it unless we manually reverse the `user` and `organization` object but that's not ideal. ### Additional context This is what the `organization` object shows: ```json { "id": "adfdasfdasfsa", "organizationId": "GfKQybkLjFaAuOyav02YNUGObHhxBMFH", "userId": "95TGZuD99WVJ", "role": "member", "createdAt": "2025-01-18T08:29:28.225Z", "user": { "id": "95TGZuD99WVJ", "name": "John Doe", "email": "johndoe@example.com", "image": "https://example.com/avatar.png" } } ```
Author
Owner

@dosubot[bot] commented on GitHub (Jun 11, 2025):

Hi, @mmikhan. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary

  • Proposal to enhance the data structure by adding an organization object to the user object.
  • Aims to streamline access to organization details directly from user information.
  • No activity or comments have been made on this issue yet.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jun 11, 2025): Hi, @mmikhan. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary** - Proposal to enhance the data structure by adding an `organization` object to the `user` object. - Aims to streamline access to organization details directly from user information. - No activity or comments have been made on this issue yet. **Next Steps** - Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If there is no further activity, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@jamie-zaharopoulos-fh commented on GitHub (Jun 18, 2025):

Hello,

I just saw this was marked stale after getting the closed notification. I had been watching this to see for some progress on this.

I know I for one would love to see this instead of having to use workarounds with custom session info plugin to get this info.

@jamie-zaharopoulos-fh commented on GitHub (Jun 18, 2025): Hello, I just saw this was marked stale after getting the closed notification. I had been watching this to see for some progress on this. I know I for one would love to see this instead of having to use workarounds with custom session info plugin to get this info.
Author
Owner

@mmikhan commented on GitHub (Jun 18, 2025):

Seems I cannot reopen this. @Bekacru is this something can be considered to reopen?

@mmikhan commented on GitHub (Jun 18, 2025): Seems I cannot reopen this. @Bekacru is this something can be considered to reopen?
Author
Owner

@dosubot[bot] commented on GitHub (Jun 18, 2025):

@Bekacru, the user mmikhan has indicated that the issue should be considered for reopening. Could you please take a look and assist them?

@dosubot[bot] commented on GitHub (Jun 18, 2025): @Bekacru, the user mmikhan has indicated that the issue should be considered for reopening. Could you please take a look and assist them?
Author
Owner

@Bekacru commented on GitHub (Jun 18, 2025):

Thanks bot. I think we can at least help here since it's a common use case. I'll take a look @mmikhan

@Bekacru commented on GitHub (Jun 18, 2025): Thanks bot. I think we can at least help here since it's a common use case. I'll take a look @mmikhan
Author
Owner

@dosubot[bot] commented on GitHub (Sep 17, 2025):

Hi, @mmikhan. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested adding an organization object within the user object to simplify access to organization details and improve API consistency.
  • The issue was marked stale due to inactivity but received support from another user, jamie-zaharopoulos-fh.
  • You asked for the issue to be reopened, and the maintainer Bekacru acknowledged the use case and committed to reviewing it.
  • The issue remains unresolved with no further updates since the maintainer's acknowledgment.

Next Steps:

  • Please let me know if this feature request is still relevant to the latest version of better-auth by commenting on this issue.
  • If I do not hear back within 7 days, the issue will be automatically closed.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Sep 17, 2025): Hi, @mmikhan. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested adding an organization object within the user object to simplify access to organization details and improve API consistency. - The issue was marked stale due to inactivity but received support from another user, jamie-zaharopoulos-fh. - You asked for the issue to be reopened, and the maintainer Bekacru acknowledged the use case and committed to reviewing it. - The issue remains unresolved with no further updates since the maintainer's acknowledgment. **Next Steps:** - Please let me know if this feature request is still relevant to the latest version of better-auth by commenting on this issue. - If I do not hear back within 7 days, the issue will be automatically closed. Thank you for your understanding and contribution!
Author
Owner

@mmikhan commented on GitHub (Sep 18, 2025):

It's still relevant

@mmikhan commented on GitHub (Sep 18, 2025): It's still relevant
Author
Owner

@himself65 commented on GitHub (Sep 18, 2025):

Related to https://github.com/better-auth/better-auth/pull/4754

We need db join supports first

@himself65 commented on GitHub (Sep 18, 2025): Related to https://github.com/better-auth/better-auth/pull/4754 We need db join supports first
Author
Owner

@dosubot[bot] commented on GitHub (Dec 18, 2025):

Hi, @mmikhan. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested adding an organization object within the user object for easier access to organization info.
  • The issue was marked stale due to inactivity but later received support and acknowledgment from the maintainers.
  • A comment noted that database join support is a prerequisite for this feature.
  • The issue remains open and unresolved, with no further implementation updates yet.

What's Next:

  • Please let me know if this issue is still relevant to the latest version of better-auth by commenting here.
  • If I don’t hear back within 7 days, the issue will be automatically closed.

Thanks for your understanding and contribution!

@dosubot[bot] commented on GitHub (Dec 18, 2025): Hi, @mmikhan. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested adding an organization object within the user object for easier access to organization info. - The issue was marked stale due to inactivity but later received support and acknowledgment from the maintainers. - A comment noted that database join support is a prerequisite for this feature. - The issue remains open and unresolved, with no further implementation updates yet. **What's Next:** - Please let me know if this issue is still relevant to the latest version of better-auth by commenting here. - If I don’t hear back within 7 days, the issue will be automatically closed. Thanks for your understanding and contribution!
Author
Owner

@mmikhan commented on GitHub (Dec 18, 2025):

Still remains

@mmikhan commented on GitHub (Dec 18, 2025): Still remains
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#574