DEV Community

Cover image for Using Clerk to authenticate users in a Go backend

Using Clerk to authenticate users in a Go backend

Marcus Kohlberg on February 27, 2024

In this short guide you will learn how to set up an Encore auth handler that makes use of Clerk in order to add an integrated signup and login expe...
Collapse
 
fmerian profile image
fmerian • Edited

thanks for this tutorial, @marcuskohlberg! we just featured it on our latest product update here πŸ™Œ

fun fact: Clerk's backends are written in Go and the backend that powers our Dashboard experience is a heavy consumer of our open-source Clerk Go SDK!

Collapse
 
marcuskohlberg profile image
Marcus Kohlberg Encore

Awesome, thanks for sharing!

Collapse
 
ceaser_ak profile image
ceaser

hey @fmerian how do you handler data sync from clerk to the database in golang via webhooks? there aren't many good resources out there which explains this, couldn't find a go example in official repo as well.

Collapse
 
brianmmdev profile image
Brian Morrison II

Give this a look and let me know if you have any questions!

github.com/bmorrisondev/clerk-go-w...

It shows how to parse the user.created and organization.created events into Go structs so you can handle them however you need. You'd need to create the structs for any other events you want to parse, but you can do this pretty easily with ChatGPT and the samples provided in the Webhooks section of our dashboard.

I'm going to push to get something more official but this should at least get you going. Hope it helps!

Collapse
 
fmerian profile image
fmerian
Thread Thread
 
ceaser_ak profile image
ceaser

@brianmmdev ^^ , would love to get a proper official go guide on this