Skip to content

Commit b287bfc

Browse files
author
Tatiana Gornak
committed
Credential Manager API. Use store instead of notifySignIn.
1 parent 5233fe8 commit b287bfc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

demos/credential-management-api-test/credential.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,17 @@ <h1>AN AMAZING DEMO OF THE ASTOUNDING CREDENTIAL MANAGER API!</h1>
6868

6969
var credential = createCredentialFromForm(document.querySelector('form'));
7070
if (credential) {
71+
try {
7172
navigator.credentials.notifySignedIn(credential).then(function () {
7273
addNote("Notification sent: " + credentialToString(credential));
7374
});
75+
} catch (e) {
76+
if (!(e instanceof TypeError))
77+
throw e;
78+
navigator.credentials.store(credential).then(function () {
79+
addNote("Store credentials: " + credentialToString(credential));
80+
});
81+
}
7482
}
7583
}
7684
});
@@ -89,7 +97,7 @@ <h1>AN AMAZING DEMO OF THE ASTOUNDING CREDENTIAL MANAGER API!</h1>
8997
addIssue("Error: <code>" + e.message + "</code>");
9098
});
9199
}
92-
});
100+
});
93101

94102
/*********************************************************************************
95103
* HELPER FUNCTIONS THAT HAVE NOTHING TO DO WITH CREDENTIAL MANAGEMENT IN ITSELF *

0 commit comments

Comments
 (0)