Saving Credentials with Credential Managent API
At Auth.js
we will update postLogin
and logout
adding the following algoritms:
Post-Login
// Credential Management API
if (window.PasswordCredential && user.password) {
const credential = new PasswordCredential({
name: user.name,
id: user.email,
password: user.password
});
navigator.credentials.store(credential);
}
Logout
if (window.PasswordCredential) {
navigator.credentials.preventSilentAccess()
}