Credential.byDocument()

Signature

Credential.byDocument(document: { *: Any } | Null) => Ref<Credential>

Description

Gets a credential, represented as a Credential document, by its identity document.

A credential associates a password with an identity document. You can use credentials and the credential.login() method to create tokens as part of an end-user authentication system.

Parameters

Parameter Type Required Description

document

Object

true

Identity document for the credential to retrieve.

Return value

Type Description

Ref<Credential>

Resolved reference to a Credential document. Can resolve to an existing document or a NullDoc.

Examples

let document = Customer.byId("111")
Credential.byDocument(document)
{
  id: "401328088781160521",
  coll: Credential,
  ts: Time("2099-06-21T18:39:00.735Z"),
  document: Customer("111")
}
\