IdentityCredential: isAutoSelected property

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Thuộc tính chỉ đọc isAutoSelected của giao diện IdentityCredential cho biết đăng nhập liên kết có được thực hiện bằng xác thực lại tự động (tức là không có sự can thiệp của người dùng) hay không.

Xác thực lại tự động có thể xảy ra khi lệnh gọi navigator.credentials.get() được phát ra với giá trị tùy chọn mediation"optional" hoặc "silent".

Giá trị

Giá trị boolean. true cho biết xác thực lại tự động đã được sử dụng; false cho biết không.

Ví dụ

Đăng nhập liên kết cơ bản và truy cập isAutoSelected

js
async function signIn() {
  const identityCredential = await navigator.credentials.get({
    identity: {
      providers: [
        {
          configURL: "https://accounts.idp.example/config.json",
          clientId: "********",
        },
      ],
    },
    mediation: "optional", // this is the default
  });

  // isAutoSelected is true if auto-reauthentication occurred.
  const isAutoSelected = identityCredential.isAutoSelected;
}

Thông số kỹ thuật

Specification
Federated Credential Management API
# dom-identitycredential-isautoselected

Tương thích trình duyệt

Xem thêm