[GH-ISSUE #325] How to access user accounts? #8221

Closed
opened 2026-04-13 03:19:16 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @zAlweNy26 on GitHub (Oct 24, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/325

I would like to use information from the accounts table that stores providers to perform some actions, but I haven't found a way to do this except within a custom plugin. Is it possible to do it from the outside? Am I missing something fundamental?

Originally created by @zAlweNy26 on GitHub (Oct 24, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/325 I would like to use information from the `accounts` table that stores providers to perform some actions, but I haven't found a way to do this except within a custom plugin. Is it possible to do it from the outside? Am I missing something fundamental?
GiteaMirror added the locked label 2026-04-13 03:19:16 -05:00
Author
Owner

@koohz commented on GitHub (Oct 25, 2024):

Maybe I'm misunderstanding the question but, couldn't you do this with your database client?

prismaClient.user.findFirst({
    where : {
        id : userID
    },
    include : {
        Account : true
    }
})
<!-- gh-comment-id:2437326332 --> @koohz commented on GitHub (Oct 25, 2024): Maybe I'm misunderstanding the question but, couldn't you do this with your database client? ```typescript prismaClient.user.findFirst({ where : { id : userID }, include : { Account : true } }) ```
Author
Owner

@zAlweNy26 commented on GitHub (Oct 25, 2024):

You are right, I just thought it would be a nice addition to have also that default table exposed from the betterAuth APIs. Or maybe it's unnecessary and I should do as you said...

<!-- gh-comment-id:2437831797 --> @zAlweNy26 commented on GitHub (Oct 25, 2024): You are right, I just thought it would be a nice addition to have also that default table exposed from the betterAuth APIs. Or maybe it's unnecessary and I should do as you said...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8221