Query.token()

Get the authentication secret’s token document or JWT payload.

Signature

Query.token() => Any | Null

Description

The token() method gets the token document or JWT payload for the authentication secret.

If the secret is a token, the method returns the token’s document from the native Token collection. 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

Any

Token document or JWT payload.

Null

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")
}

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!