-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugins): add Clerk plugin to manage users with webhooks #91
Conversation
b5840a8
to
681b1db
Compare
Thanks for this contribution. It's been on my list for a while to make a more official integration with Clerk as a plugin so your good intuition worked out here. I'll work on taking a closer look at this and doing some testing on my end hopefully today and be able to report back. Greatly appreciate this PR :)
This is something that has been swirling around in my head as well if we need to move them into their own repository, or if it's more desirable that they're available in the core project too. Still haven't solidified the right answer here but nonetheless I like where your head is at here! |
@jeroenptrs Plugin works like a charm, just as described! Eventually it would be great to bring over I know this PR is dependent on #89 as well so will review that PR before approving this one. Great work 👏 |
Sounds to me like using Clerk's own hono middleware could also fit the bill? Reading up on verifying in starbase, this should be feasible quite easily and removes the dependency of doing a call to Clerk altogether if users just configure the PEM Public Key instead. Wdyt? |
5cb03b6
to
d79c314
Compare
FYI updated the PR with functionality to verify user sessions inside of the plugin (no external calls to Clerk needed, so this goes pretty swiftly! |
chore: update pnpm-lock.yaml with new package resolutions
d47e4a6
to
b56d6ea
Compare
ac93fd0
to
8caa9fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for working so hard on getting this over the finish line 🚀
@Brayden nice, for me it's also ready to merge then! |
Purpose
Heavily based on the Stripe plugin, this plugin adds support for Clerk webhooks to insert user data into a table to link users to any data (like Stripe subscriptions, as also apparently this Clerk roadmap item is a Stripe integration)
I've doubted between contributing this as a PR and a userland npm/jsr package, but as there's stripe and slack plugins too, it made sense to include it here. Besides, it also depends on the SQL file support I added in #89 😅
That said, not necessarily needed for discussion here, but the plugin system could potentially be extracted and collected in an awesome-starbase repo?
Tasks
pnpm install --frozen-lockfile
to errorauthenticate
function to the plugin that verifies a user sessionVerify
src/index.ts
Result
I quickly tested with ngrok because I've been working on setting up these webhooks in a project of mine as well 😅