CurrentIdentity
Not available in this language, yet.
Not available in this language, yet.
CurrentIdentity()
CurrentIdentity()
current_identity()
CurrentIdentity()
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.
ref(id = "1", collection = ref(id = "users", collection = ref(id = "collections")))
Ref(Collection("users"), "1")
Ref(id=1, collection=Ref(id=users, collection=Ref(id=collections)))
ref(id = "1", collection = ref(id = "users", collection = ref(id = "collections")))
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.
"l6vJS8QvHC2LmiGRaOTiE16givuufR22@clients"
l6vJS8QvHC2LmiGRaOTiE16givuufR22@clients
Not available in this language, yet.
"l6vJS8QvHC2LmiGRaOTiE16givuufR22@clients"
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's Discourse forums
or email docs@fauna.com
Thank you for your feedback!