Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

Credential.create()

Learn: Credentials

Create a credential.

Signature

Credential.(data: { id: ID | Null, document: Ref<{ *: Any }>, password: String | Null, data: { *: Any } | Null }) => 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

Object

Yes

Document fields for the new Credential document.

For supported document fields, see Credential collection.

Return value

Type Description

Credential

Document in the Credential system collection. See Credential.

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!