are there examples showing how to do authentication in a cloudflare worker ?
Hi Folks
I am investigating how to use cloudflare workers as an api getway. I have a go service that is running in cly.io and i want to restrict calls made to this service to all be authenticated. So that plan is to put qorkers in front of that api.
here is the flow
client --> cloudfare-workers -> my-go-ap
The idea is to call either supabase or clerk from the cloudflare worker and redirect the call to my service once it is authenticated. Are there any examples close to this i could learn from ?
Best regards2 Replies
Why do you need worker for this? You can implement Clerk go-sdk directly in go.
If you need worker, then you can use @clerk/backend and
authenticateRequest
(or verifyToken
) function.
Just check Clerk docs, it is super simple.hi @Radoš
thank you for jumping on this. i am putting cloudflare rate-limit and protection in front of the api. i dont want client to directly call the go backend. hope that makes sense
cloudflare also has analytics/logs and maybe many more things all in the free tier so its very tempting