Retrive organizations members with bearer token

Hello !

I use the bearer plugin to authenticate requests to a websocket server that cannot support the better-auth default format.

I take as parameters the name of an organization (I've enabled the plugin) and the bearer token.

I need to find the organizations of which the user is a member, based on the token passed, so that I can compare their names with the one passed to me.

I'm already retrieving the session, but I'm having trouble seeing how I can get the list of organizations of which he's a member.

        const authData = await auth.api.getSession({
            headers: new Headers({
                "Authorization": `Bearer ${token}`
            })
        })
Solution
My bad, my vscode autocompletion just sucks, i just need to pass headers with the same way to authorize correctly
Was this page helpful?