I'm using a Cloudflare Pages Function as a middleware to check user authentication before loading any site assets. Using Clerk as an example, it looks kinda like this:
However, I'm unable to figure out how to do something similar with Kinde. The Kinde node libraries don't work because the Function environment doesn't allow the necessary libraries. I found this post which offers a solution for this, https://kinde.com/blog/engineering/verifying-jwts-in-cloudflare-workers/, but Kinde doesn't pass an authorization or cookie in the request even when I'm signed in, so there is nothing to verify. Is this just because I'm not using a custom domain in Kinde? I'm confused because the underlying React app recognizes me as being signed in, so there must be some mechanism to authenticate the user. For clarity, I also don't have a custom domain in Clerk, but maybe they set cookies by default, I'm not sure.