This package provides Clerk Backend API resources and low-level authentication utilities for JavaScript environments. It is mostly used as the base for other Clerk SDKs but it can be also used on its own.
Features
Built for V8 isolates (Cloudflare Workers, Vercel Edge Runtime, etc...).
Make it isomorphic to work across all modern JS runtimes.
Use options injection for all keys and settings.
Support multiple CLERK_SECRET_KEY for multiple instance REST access.
Align JWT key resolution algorithm across all environments (Function param > Environment variable > JWKS from API).
Tested automatically across different runtimes (Node, CF Workers, Vercel Edge middleware.)
Refactor the Rest Client API to return {data, errors} instead of throwing errors.
Export a generic verifyToken for Clerk JWTs verification.
Align AuthData interface for SSR.
Export CJS and ESM.
How to use
Works on Node.js >=18.17.0 (or later) or on any V8 Isolates runtimes (eg Cloudflare Workers).
Create Clerk SDK that includes an HTTP Rest client for the Backend API and session verification helpers. The clerk object contains the following APIs and methods:
import { createClerkClient } from'@clerk/backend';
const clerk = createClerkClient({ secretKey: '...' });
await clerk.users.getUser('user_...');
// Available APIs
clerk.allowlistIdentifiers;
clerk.clients;
clerk.emailAddresses;
clerk.emails;
clerk.invitations;
clerk.organizations;
clerk.phoneNumbers;
clerk.redirectUrls;
clerk.sessions;
clerk.signInTokens;
clerk.users;
// These functions should be used by framework-specific libraries, such as @clerk/nextjs or @clerk/remix.// Compute the authentication state given the request parameters.
clerk.authenticateRequest(options);
// Build debug payload of the request state.
clerk.debugRequestState(requestState);
Clerk Backend SDK - REST Client for Backend API & JWT verification utilities
We found that @clerk/backend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 8 open source maintainers collaborating on the project.
Last updated on 26 Apr 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).
LDAPjs, an LDAP Client and Server API for Node.js, was decommissioned after its maintainer received an abusive email from a user, raising concerns about this form of abuse as a potential attack vector.