Identity

Identity()
Identity()
Identity()
Identity()
identity()
identity()
Identity()
Identity()

Description

The Identity function returns the ref of the document associated with the authentication token used for the request. If a document does not exist, an error is returned.

Parameters

None.

Returns

A reference type to the identity associated with the current client authentication token.

Examples

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "identity": null }'
// Not available in this language yet.
System.out.println(client.query(Get(Identity())).get());
result, _ := client.Query(f.Identity())

fmt.Println(result)
// Not available in this language yet.
# Not available in this language yet.
# Not available in this language yet.
// Not available in this language yet.
client.query(q.Identity())
  .then((ret) => console.log(ret))
HTTP/1.1 400 Bad Request
{
  "errors": [
    {
      "position": [  ],
      "code": "missing identity",
      "description": "Authentication does not contain an identity"
    }
  ]
}
{
  "errors": [
    {
      "position": [  ],
      "code": "missing identity",
      "description": "Authentication does not contain an identity"
    }
  ]
}
{
  ref: (id = "200118070142829056", collection = ref(id = "users", collection = ref(id = "collections"))),
  ts: 1527106313732119,
  data: {email: "alice@example.com"}
}
{181388642114077184 0xc4202d09e0 <nil>}
{
  "errors": [
    {
      "position": [  ],
      "code": "missing identity",
      "description": "Authentication does not contain an identity"
    }
  ]
}
{
  "errors": [
    {
      "position": [  ],
      "code": "missing identity",
      "description": "Authentication does not contain an identity"
    }
  ]
}
{
  "errors": [
    {
      "position": [  ],
      "code": "missing identity",
      "description": "Authentication does not contain an identity"
    }
  ]
}
{
  "errors": [
    {
      "position": [  ],
      "code": "missing identity",
      "description": "Authentication does not contain an identity"
    }
  ]
}
Ref(id=181388642114077184, collection=Ref(id=characters, collection=Ref(id=collections)))

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!