Clerk JavaScript SDK
The Clerk JavaScript SDK, or ClerkJS, is our foundational JavaScript library for building user management and authentication. It enables you to register, sign in, verify, and manage users for your application using highly customizable flows. It powers the other JavaScript SDKs, such as the React and Next.js SDKs. The following sections will introduce you to the main objects that power the JavaScript SDK. As you're building your application, you'll likely interact with these objects, either directly or through helpers provided by the other SDKs, like React hooks or Vue composables.
Installation
Follow the instructions in the JavaScript quickstart to add the JavaScript SDK to your project.
Main objects
Clerk
The Clerk
class is the main entry point for the Clerk JavaScript SDK. All other objects are accessible from the Clerk
object.
Client
A client represents the current device or software accessing an application such as your web browser, native application, or Chrome Extension. It is represented by the Client
object.
Session
A session is a secure representation of the authentication state of the current user. Each client can hold multiple sessions on the same device. It is represented by the Session
object.
User
The User
object represents the current user of the session. It holds all the basic user information such as the user's name, email addresses, and phone numbers, and including their public, private, and unsafe metadata.
SignIn
The SignIn
object holds the state of the current sign-in and provides helper methods to navigate and complete the sign-in process. It is used to manage the sign-in lifecycle, including the first and second factor verification, and the creation of a new session.
SignUp
The SignUp
object holds the state of the current sign-up and provides helper methods to navigate and complete the sign-up process. Once a sign-up is complete, a new user is created.
Organization
Organizations are a flexible and scalable way to manage users and their access to resources within your Clerk application. With organizations, you can assign specific roles and permissions to users, making them useful for managing projects, coordinating teams, or facilitating partnerships. Users can belong to many organizations. One of them will be the "active organization" of the session. It is represented by the Organization
object. To learn about organizations, see the dedicated guide.
Feedback
Last updated on