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.

Query.identity()

Signature

Query.identity() => { *: Any } | Null

Description

Gets the identity document for the query’s authentication token.

You can call identity() in role-related predicates used for attribute-based access control (ABAC).

If the query is authenticated using a JWT or key, the method returns null. JWTs and keys aren’t tied to an identity document.

Parameters

None

Return value

One of:

Type Description

Object

identity document for the authentication token.

Null

No identity document is associated with the authentication secret.

Examples

Query.identity()
{
  id: "111",
  coll: Customer,
  ts: Time("2099-06-21T18:39:00.735Z"),
  cart: Order("413090255209497088"),
  orders: "hdW...",
  name: "Alice Appleseed",
  email: "alice.appleseed@example.com",
  address: {
    street: "87856 Mendota Court",
    city: "Washington",
    state: "DC",
    postalCode: "20220",
    country: "US"
  }
}

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!