Auth Strategy
OcopJS - Cung cấp cách xác thực cơ bản thông qua mật khẩu. 🇻🇳
Lưu ý sau khi phiên bản KeystoneJS 5 chuyển sang chế độ duy trì để ra mắt phiên bản mới hơn. Chúng tôi đã dựa trên mã nguồn cũ này để phát triển một phiên bản khác với một số tính năng theo hướng microservices.
Authenticates a party (often a user) based on their presentation of a credential pair. The credential pair consists of an identifier and a secret (often an email address and password).
yarn add @ocopjs/auth-password
Usage
Assuming a list of users such as:
ocop.createList("User", {
fields: {
username: { type: Text },
password: { type: Password },
},
});
We can configure the OcopJS auth strategy as:
const authStrategy = ocop.createAuthStrategy({
type: PasswordAuthStrategy,
list: "User",
config: {
identityField: "username",
secretField: "password",
},
});