Skip to main content
Version: v2

isBindPasskeyUrl

Validates that a URL is able to be used by the bindPasskey function.

Dependencies​

The isBindPasskeyUrl 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 isBindPasskeyUrl, you must complete the following prerequisite calls:

  1. Import the required types and functions from the SDK.
import { Embedded } from '@beyondidentity/bi-sdk-js';
  1. 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​

ParameterTypeDescription
urlstringRequired. Url to be validated as Beyond Identity passkey binding url.

Returns​

Returns a boolean.

Examples​

Example: Call bindPasskey after validating URL​

const url = "credential-binding-url";

if (EmbeddedSdk.isBindPasskeyUrl(url)) {
// The URL is valid for binding a passkey
EmbeddedSdk.bindPasskey(url)
.then(response => {
console.log("Success:", response);
})
.catch(err => {
console.error("Error:", err.message);
});
} else {
console.log("The URL is not a valid Bind Passkey URL");
}