Authentication for Cloudflare Workers
We are thrilled to announce the release of @propelauth/cloudflare-worker - a Javascript/Typescript library that makes it easy to add authentication and authorization to your Cloudflare Workers.
With this, you can write code as simple as:
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
try {
const authHeader = request.headers.get("authorization")
const user = await validateAuthHeaderAndGetUser(authHeader)
return Response.json(user)
} catch (e) {
const error = handleError(e)
return new Response(error.message, {status: error.status})
}
},
};
and you now have an easy to manage API which will reject unauthorized users. There are also no external requests needed to verify the user’s information, meaning the APIs you build will be incredibly fast by leveraging Cloudflare’s global network.
Additionally, the library provides simple interfaces for managing multi-tenancy/organizations and user roles/permissions, making it perfect for any B2B products you are building.
PropelAuth was founded with the goal of making developers' lives easier by providing out-of-the-box solutions for authentication and authorization. Right after you sign up, you’ll have a working set of UIs that your users can use to create organizations, invite their coworkers, and even set up enterprise SSO connections for your larger customers.
We believe that this library will greatly simplify the process of adding authentication and authorization to Cloudflare Workers, making it easier for developers to create secure and robust serverless applications. We are excited to see what you all will build!