Skip to main content
Version: v2

getPasskeys

The getPasskeys function enables your app to get a list of all passkeys currently bound to the device, for example to create a user experience for selecting a passkey.

Dependencies​

The getPasskeys function requires the Beyond Identity SDK.

yarn add @beyondidentity/bi-sdk-js

or

npm install @beyondidentity/bi-sdk-js

Prerequisites​

Before making a call to getPasskeys, you must complete the following prerequisite calls:

  1. Import the required types and functions from the SDK.

    import { Embedded } from '@beyondidentity/bi-sdk-js';
  2. Initialize the SDK.

    // --- Initialize with required arguments
    try {
    const embedded = await Embedded.initialize();
    console.log("Initialization successful", embedded);
    } catch (error) {
    console.error("Initialization failed:", error);
    }

    // --- Initialize with required and optional arguments
    const config = {
    allowedDomains: ["example.com", "another-example.com"],
    logger: function (logType, message) {
    console.log(`[${logType}] ${message}`);
    },
    };

    try {
    const embedded = await Embedded.initialize(config);
    console.log("Initialization successful", embedded);
    } catch (error) {
    console.error("Initialization failed:", error);
    }

Parameters​

none

Returns​

Upon success, returns an array/list of Passkey.

Examples​

Example: Call getPasskeys and surface the list to the user to select a passkey​

const allPasskeys = await embedded.getPasskeys();