Skip to main content
Version: 2.0.0-beta

How to Register a User

Registration can be done quickly. There are two main ways to register a new user to your platform using one of:

  • Passkey
  • Email Verification

Behind the scenes, a complete registration will first create a user tied to a tenant, then will bind a credential to that user.

Below are a few examples using our SDKs. If you'd like a more detailed look at the API, please take a look at the OpenAPI Specs.


Prerequisites

Create Web Tenant

Use an existing tenant or create a new one to obtain the project base URL and application ID.

Register a User via Passkey

note

When creating your tenant using Go Start, please note that it enforces email verification, and as a result, this API may not function correctly. Users will only be able to register using the email verification method. If you want to create a tenant where users can register a passkey without email verification, go to the advanced create tenant page to create a tenant there instead and set the Username Format to None.

Below is an example using our Web SDK Javascript to register a user via Passkey.

Web SDK Javascript
import { LoginIdConfiguration, LoginIdPasskey } from "@loginid/web-sdk";

// Obtain credentials from LoginID Tenant
const BASE_URL = process.env.BASE_URL;
const APP_ID = process.env.APP_ID;

// Initialize the SDK with your configuration
const config = new LoginIdConfiguration(BASE_URL, APP_ID);

// Use the SDK components for signup and signin
const lid = new LoginIdPasskey(config);

// Button click handler
async function handleSignupButtonClick() {
const username = "exampleUser";
const signupOptions = {
credname: "My Passkey",
};

try {
// Sign up with a passkey
const signupResult = await lid.signupWithPasskey(username, signupOptions);
// Handle the signup result
console.log("Signup Result:", signupResult);
} catch (error) {
// Handle errors
console.error("Error during signup:", error);
}
}

// Attach the click handler to a button
const signupButton = document.getElementById("signupButton"); // Assuming you have a button with id 'signupButton'
signupButton.addEventListener("click", handleSignupButtonClick);

Register a User via Email

Below is an example using our Web SDK Javascript to register a user via email verification.

import { LoginIdConfiguration, LoginIdEmail } from "@loginid/web-sdk";

// Obtain credentials from LoginID Tenant
const BASE_URL = process.env.BASE_URL;
const APP_ID = process.env.APP_ID;

// Initialize the SDK with your configuration
const config = new LoginIdConfiguration(BASE_URL, APP_ID);

// Use the SDK components for signup and signin
const lid = new LoginIdEmail(config);

// Button click handler
async function handleSignupButtonClick() {
const username = "johnny@email.com";

try {
// Sign up with email
const signupResult = await lid.signupWithEmail(username);
// Handle the signup result
console.log("Signup Result:", signupResult);
} catch (error) {
// Handle errors
console.error("Error during signup:", error);
}
}

// Attach the click handler to a button
const signupButton = document.getElementById("signupButton"); // Assuming you have a button with id 'signupButton'
signupButton.addEventListener("click", handleSignupButtonClick);

More Examples

  • Check out our quickstart guide to learn how to sign up a user with email verification followed by adding a passkey using the WebSDK.