npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@corbado/web-js

v3.6.1

Published

This package allows VanillsJS users to add corbado functionality and UI components in their applications

Readme

@corbado/web-js

License Documentation Slack npm version


Table of Contents


Overview

The @corbado/web-js package enables easy integration of Corbado's authentication functionalities into web projects. It can be used either by installing the package from NPM or by directly including it in your HTML files through script and style tags.


🚀 Getting Started

Option 1: Using NPM

Install the package via NPM:

npm install @corbado/web-js

Option 2: Using script and style Tags

Include the script and styles directly in your HTML:

<link
  rel="stylesheet"
  href="https://unpkg.com/@corbado/web-js@2/dist/bundle/index.css"
/>
<script src="https://unpkg.com/@corbado/web-js@2/dist/bundle/index.js"></script>

@2 loads the most recent version of major version 2. Replace @2 with a specific version number if you want to pin it. Use @latest if you always want to have the most recent version including majors (not recommended for production).


📌 Usage

Usage with NPM

Initialization:

Import and initialize Corbado in your main JavaScript or TypeScript file:

import Corbado from '@corbado/web-js';

await Corbado.load({
  projectId: 'pro-XXXXXXXXXXXXXXXXXXXX',
});

Note: It's important to initialize Corbado before using any of its functionalities.

Authentication UI

Mount the authentication UI to your HTML element:

<script>
  const authElement = document.getElementById('corbado-auth');

  // In your JavaScript or TypeScript file after initializing Corbado
  Corbado.mountAuthUI(authElement, {
    onLoggedIn: () => {
      window.location.href = '/';
    },
  });
</script>

<div id="corbado-auth"></div>

Handling Passkey List UI:

Use the Corbado.isAuthenticated boolean to check if the user is logged in and to mount the passkey list UI:

// In your JavaScript or TypeScript file after initializing Corbado if (Corbado.user) {
Corbado.mountPasskeyListUI(passkeyListHTMLElement); }

<script>
  const passkeyListElement = document.getElementById('passkey-list');

  // In your JavaScript or TypeScript file after initializing Corbado
  if (Corbado.isAuthenticated) {
    Corbado.mountPasskeyListUI(passkeyListElement);
  }
</script>

<div id="passkey-list"></div>

Handling Logout:

Use the Corbado.isAuthenticated boolean to check if the user is logged in and to handle logout:

// In your JavaScript or TypeScript file after initializing Corbado
if (Corbado.isAuthenticated) {
  logoutButton.addEventListener('click', async () => {
    await Corbado.logout();
  });
}

Usage in HTML with script and style Tags

Initialization:

Initialize Corbado in a <script> tag within your HTML:

<script type="module">
  await Corbado.load({
    projectId: 'pro-XXXXXXXXXXXXXXXXXXXX',
  });

  // Additional JavaScript to manage UI
</script>

Note: It's important to initialize Corbado before using any of its functionalities.

Handling User Authentication State:

Use JavaScript to manage login/logout states and to mount the passkey list UI:

<script type="module">
  if (!Corbado.user) {
    // Handle login state
  } else {
    // Handle logout state and mount passkey list
  }
</script>

Note:

  • The use of the type="module" attribute is necessary to use ES6 modules in the browser. For more information, please refer to this article.
  • Use of Corbado with <script> tag is similar to using it with NPM, except that you don't need to import the package and you can use the Corbado object directly from the global scope.

💡 Example Applications


📄 Documentation & Support

For support and questions please visit our Slack channel. For more detailed information and advanced configuration options, please visit our Documentation Page.

🚢 Release Notes

Find out what we've shipped! Check out the changelog files here


🔒 License

This project is licensed under the MIT License - see the LICENSE file for details.