The Fauna service will be ending on May 30, 2025.

For more information on the service wind down, see our announcement and the Fauna Service End-of-Life FAQ.

Query.token()

Get the Token document or JWT payload for the query’s authentication secret.

Signature

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

Description

Gets the Token document or JWT payload for the query’s authentication secret.

If the secret is a token, the method returns the token’s Token system collection document. This token document is distinct from the token’s identity document.

If the secret is a JWT, the method returns the JWT’s payload.

If the secret is a key, the method returns null.

Parameters

None

Return value

One of:

Type Description

Object

Token document or JWT payload.

Null

The authentication secret is a key.

Examples

Query.token()
{
  id: "412664453937496576",
  coll: Token,
  ts: Time("2099-07-06T19:11:13.570Z"),
  document: Customer("111")
}
\