Identity

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

Description

The Identity function returns the ref of the instance associated with the authentication token used for the request. If an instance 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", class = ref(id = "users", class = ref(id = "classes"))),
  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, class=Ref(id=characters, class=Ref(id=classes)))