IdentityCredential: token property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Thuộc tính chỉ đọc token của giao diện IdentityCredential trả về token được sử dụng để xác thực đăng nhập liên kết.
API FedCM không xác định cấu trúc của đối tượng token hay RP nên làm gì với nó: điều này hoàn toàn phụ thuộc vào giao thức danh tính liên kết mà IdP thực hiện.
Giá trị
Bất kỳ kiểu nào.
Ví dụ
>Đăng nhập liên kết cơ bản và truy cập token
js
async function signIn() {
const identityCredential = await navigator.credentials.get({
identity: {
providers: [
{
configURL: "https://accounts.idp.example/config.json",
clientId: "********",
params: {
/* IdP-specific parameters */
},
},
],
},
});
console.log(identityCredential.token);
}
Thông số kỹ thuật
| Specification |
|---|
| Federated Credential Management API> # dom-identitycredential-token> |