CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-amazon-cognito-identity-js

Amazon Cognito Identity Provider JavaScript SDK for user authentication and management

Pending
Overview
Eval results
Files

device-management.mddocs/

Device Management

Device tracking, remembering, and management for enhanced security and user experience.

Capabilities

Device Information and Listing

/**
 * Gets information about the current device
 * @param callbacks - Success/failure callback handlers
 */
getDevice(callbacks: {
  onSuccess: (success: string) => void;
  onFailure: (err: Error) => void;
}): void;

/**
 * Lists all devices associated with the user
 * @param limit - Maximum number of devices to return
 * @param paginationToken - Token for paginated results (null for first page)
 * @param callbacks - Success/failure callback handlers
 */
listDevices(
  limit: number,
  paginationToken: string | null,
  callbacks: {
    onSuccess: (data: any) => void;
    onFailure: (err: Error) => void;
  }
): void;

Device Status Management

/**
 * Sets the current device as remembered
 * @param callbacks - Success/failure callback handlers
 */
setDeviceStatusRemembered(callbacks: {
  onSuccess: (success: string) => void;
  onFailure: (err: any) => void;
}): void;

/**
 * Sets the current device as not remembered
 * @param callbacks - Success/failure callback handlers
 */
setDeviceStatusNotRemembered(callbacks: {
  onSuccess: (success: string) => void;
  onFailure: (err: any) => void;
}): void;

Device Forgetting

/**
 * Forgets the current device
 * @param callbacks - Success/failure callback handlers
 */
forgetDevice(callbacks: {
  onSuccess: (success: string) => void;
  onFailure: (err: Error) => void;
}): void;

/**
 * Forgets a specific device by device key
 * @param deviceKey - Unique identifier for the device
 * @param callbacks - Success/failure callback handlers
 */
forgetSpecificDevice(
  deviceKey: string,
  callbacks: {
    onSuccess: (success: string) => void;
    onFailure: (err: Error) => void;
  }
): void;

Usage Examples:

// List user devices
cognitoUser.listDevices(10, null, {
  onSuccess: (data) => {
    console.log("User devices:", data.Devices);
    data.Devices.forEach(device => {
      console.log(`Device: ${device.DeviceKey}, Status: ${device.DeviceStatus}`);
    });
  },
  onFailure: (err) => {
    console.error("Failed to list devices:", err);
  }
});

// Remember current device
cognitoUser.setDeviceStatusRemembered({
  onSuccess: (result) => {
    console.log("Device remembered:", result);
  },
  onFailure: (err) => {
    console.error("Failed to remember device:", err);
  }
});

// Forget a specific device
cognitoUser.forgetSpecificDevice("device-key-123", {
  onSuccess: (result) => {
    console.log("Device forgotten:", result);
  },
  onFailure: (err) => {
    console.error("Failed to forget device:", err);
  }
});

Install with Tessl CLI

npx tessl i tessl/npm-amazon-cognito-identity-js

docs

authentication.md

device-management.md

index.md

mfa.md

session-management.md

storage.md

user-attributes.md

user-management.md

user-pool.md

tile.json