Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@clerk/backend
Advanced tools
Clerk Backend SDK - REST Client for Backend API & JWT verification utilities
@clerk/backend is a Node.js package that provides backend functionality for authentication and user management. It allows developers to integrate user authentication, manage user sessions, and handle user data securely and efficiently.
User Authentication
This feature allows you to authenticate users using a token. The code sample demonstrates how to verify a user's token and retrieve user information.
const { Clerk } = require('@clerk/backend');
const clerk = new Clerk({ apiKey: 'your-api-key' });
async function authenticateUser(token) {
const user = await clerk.users.verifyToken(token);
return user;
}
authenticateUser('user-token').then(user => console.log(user)).catch(err => console.error(err));
Session Management
This feature allows you to manage user sessions. The code sample demonstrates how to retrieve a session by its ID.
const { Clerk } = require('@clerk/backend');
const clerk = new Clerk({ apiKey: 'your-api-key' });
async function getSession(sessionId) {
const session = await clerk.sessions.getSession(sessionId);
return session;
}
getSession('session-id').then(session => console.log(session)).catch(err => console.error(err));
User Management
This feature allows you to manage user data. The code sample demonstrates how to retrieve user information by user ID.
const { Clerk } = require('@clerk/backend');
const clerk = new Clerk({ apiKey: 'your-api-key' });
async function getUser(userId) {
const user = await clerk.users.getUser(userId);
return user;
}
getUser('user-id').then(user => console.log(user)).catch(err => console.error(err));
Auth0 is a flexible, drop-in solution to add authentication and authorization services to your applications. It provides a wide range of features including social login, multi-factor authentication, and user management. Compared to @clerk/backend, Auth0 offers more extensive integrations and a broader set of features but can be more complex to set up.
Firebase Admin SDK allows you to integrate Firebase services into your server-side applications. It provides functionalities for user authentication, database management, and cloud messaging. Compared to @clerk/backend, Firebase Admin SDK offers a more comprehensive suite of backend services but may require more configuration and setup.
Passport is an authentication middleware for Node.js that supports a wide range of authentication strategies. It is highly modular and can be integrated with various authentication providers. Compared to @clerk/backend, Passport is more flexible and customizable but requires more effort to implement and manage different authentication strategies.
Clerk's JavaScript Backend SDK exposes Clerk's Backend API resources and low-level authentication utilities for JavaScript environments.
>=18.17.0
(or later) or any V8 isolates runtimeThe fastest way to get started with @clerk/backend
is by following the JavaScript Backend SDK reference documentation.
You'll learn how to install @clerk/backend
and how to use createClerkClient()
.
For further information, guides, and examples visit the JavaScript Backend SDK reference documentation. It lists all the available APIs and methods.
This project uses vitest as the unit test runner and msw for mocking network requests.
If you need to see which requests are being intercepted by msw
, you can run the test suite with the following env: DEBUG_MOCK_REQUESTS=true
You can get in touch with us in any of the following ways:
We're open to all community contributions! If you'd like to contribute in any way, please read our contribution guidelines and code of conduct.
@clerk/backend
follows good practices of security, but 100% security cannot be assured.
@clerk/backend
is provided "as is" without any warranty. Use at your own risk.
For more information and to report security issues, please refer to our security documentation.
This project is licensed under the MIT license.
See LICENSE for more information.
FAQs
Clerk Backend SDK - REST Client for Backend API & JWT verification utilities
The npm package @clerk/backend receives a total of 189,754 weekly downloads. As such, @clerk/backend popularity was classified as popular.
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.
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.