add better-auth integration - #329
stevekaliski-stripe wants to merge 1 commit into
Conversation
e328a56 to
d8a6a78
Compare
4785492 to
5f67b2a
Compare
bytaesu
left a comment
There was a problem hiding this comment.
How about exposing 2 plugin APIs?
await authClient.link.connect({
callbackURL: "/settings",
});
await authClient.link.disconnect({
accountId,
});With current structure, connecting a Link wallet requires calling authClient.linkSocial(). The plugin could provide a clearer Link-specific API while reusing Better Auth existing OAuth flow internally.
link.connect()would be a thin wrapper aroundlinkSocial().link.disconnect()would be a dedicated endpoint that validates a fresh session, account ownership, and last-account protection, then revokes the Link refresh token and deletes the local account only after revocation succeeds.
https://docs.stripe.com/agentic-commerce/link-cli/oauth#revoke-access
a4b7957 to
d6ca887
Compare
Committed-By-Agent: codex Co-authored-by: codex <noreply@openai.com> Committed-By-Agent: codex Co-authored-by: codex <noreply@openai.com> Committed-By-Agent: codex Co-authored-by: codex <noreply@openai.com> Committed-By-Agent: codex Co-authored-by: codex <noreply@openai.com>
d6ca887 to
5698d26
Compare
|
@stevekaliski-stripe I created a temporary PR targeting the current branch, using our existing way of writing the plugin while making it structurally cleaner and easier to extend. Could you take a look and let me know if anything is unclear? #355 |
| getActions: ($fetch) => ({ | ||
| link: { | ||
| connect: <Throw extends boolean = false>( | ||
| options: LinkConnectOptions = {}, | ||
| fetchOptions?: Omit<BetterFetchOption, 'throw'> & { throw?: Throw }, | ||
| ) => | ||
| $fetch('/link-social', { | ||
| ...fetchOptions, | ||
| throw: fetchOptions?.throw ?? false, | ||
| method: 'POST', | ||
| body: { ...options, provider: 'link' }, | ||
| }) as Promise<LinkConnectResult<Throw>>, | ||
| }, | ||
| }), |
There was a problem hiding this comment.
For context, using a client action would make the endpoint accessible only through authClient, so it may not be the cleanest fit here.
For my proposal, please refer to the implementation in my previous comment 🤓
No description provided.