Credential.create()
Learn: Credentials |
---|
Create a credential.
Description
The Credential.create()
method creates a
credential.
A credential associates a password with an identity document.
You can use credentials to create tokens as part of an end-user authentication system.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
data |
Yes |
Object describing the credential. |
data fields
Name | Type | Required | Description |
---|---|---|---|
document |
Yes |
Identity document. Must be in a user-defined collection. Tokens created using the credential are tied to this document. An identity document can only have one credential. |
|
password |
Password associated with the credential. Typically an end user’s password. |
Return value
Type | Description |
---|---|
Document in the |
Examples
Credential.create({
document: Customer.byId("111"),
password: "sekret"
})
{
id: "401670627820306505",
coll: Credential,
ts: Time("2099-06-25T13:23:31.440Z"),
document: Customer("111")
}
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!