2-step login flow and organization question

Hi! I am trying to implement a 2-step login flow where the user first inputs the email address, then depending on the email domain and if the user is already provisioned follow-up with the second step. My questions: - is there a built-in solution to fetch (user/organization) just by an email without an existing session? - it seems the sso plugin can handle linking an sso provider to an organization, so that once i know who the user is, and in which organization he/she is a member of, I can show sso provider buttons on the sign-in screen. Except, it is not disclosed in the docs -seemingly- how one would link a provider to an organization? Thanks in advance.
2 Replies
bekacru
bekacru4w ago
you can provide organizationId when you create a provider using the sso plugin
Jim-Y
Jim-YOP4w ago
Thanks @bekacru . I will try it out. Do you have any input on my other question? To phrase that question simpler, is it possible to query the database tables when there is no session? That is, using the server api when the headers won't contain a cookie? I want to search information about an email address which might, or might not be in the system. (note: i did implement this but not using better-auth, but simply querying the db. I'm just wondering if this is possible with the better-auth api)

Did you find this page helpful?