Skip to main content

List, Rename, Delete Passkeys

Users will need a way to create, view, and manage their passkeys after successfully registering a passkey with LoginID. Passkey management is important for security and user control. By listing, renaming, or deleting passkeys, users can:

  • Keep their accounts secure by removing unused or compromised passkeys.
  • Maintain clarity by renaming passkeys for easy identification.

There are two ways to access these passkey management methods:

Prerequisites

  • Create an application to obtain a base URL
  • Create an API key with at least passkey:read, passkey:write, and reg:write scopes. (Only for backend integration method.)

Setup SDK

npm i @loginid/websdk3

Import and initialize an instance:

import { LoginIDWebSDK } from "@loginid/websdk3";

const lid = new LoginIDWebSDK({
baseUrl: process.env.LOGINID_BASE_URL,
});

Examples

info

The code samples provided are for backend integrations using authorization tokens. Using the LoginID token's authenticated session does not require passing any tokens and can call the methods directly after a successful passkey authentication.

import { useAuth } from "../../contexts/AuthContext";
import { LoginIDWebSDK } from "@loginid/websdk3";

const config = {
baseUrl: BASE_URL,
};

const lid = new LoginIDWebSDK(config);

const PasskeyManagement: React.FC = () => {
const { user } = useAuth();
const [passkeys, setPasskeys] = useState([]);

useEffect(() => {
const run = async () => {
try {
// Get authorization token from your backend
// only if your backend is responsible for verifying user access.

// Passkey list
const _passkeys = await lid.listPasskeys({
authzToken: token,
});

setPasskeys(_passkeys);
} catch (e) {
if (e instanceof Error) {
setError(e.message);
}
}
};
run();
}, []);
};