Query.token()

Get the current token.

Signature

Query.token() => Document | Object | Null

Description

This method gets the Token document or JSON Web Token (JWT) payload for the current session.

Parameters

None

Return value

One of:

Type Description

Token

A Token document.

Null

If the current session is a Key session, this method returns Null.

Object

A JWT payload.

Examples

Query.token()
    {
      id: "369530580236238881",
      coll: Token,
      ts: Time("2023-07-06T19:11:13.570Z"),
      document: Person.byId("369515102952488993")
    }

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!