CurrentIdentity
Identity()
Identity()
Identity()
Identity()
identity()
Identity()
Description
The CurrentIdentity
function returns the
Reference of the document associated with
the authentication token used for the request. If a document does not
exist, an error is returned.
When authentication is performed by an identity provider, CurrentIdentity
returns the contents of the associated JWT’s sub
field.
Returns
A Reference to the identity associated with the current client authentication token.
Examples
The following query is run in the context of a logged-in Fauna user:
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
client.query(
q.CurrentIdentity()
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
Ref(Collection("users"), "1")
Not available in this language yet.
Not available in this language yet.
The following query is run in the context of an externally-authenticated user:
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
client.query(
q.CurrentIdentity()
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
q6vJS85vH@2LmiGrAOTiE16giVUuFr22@clients
Not available in this language yet.
Not available in this language yet.
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!