Unlike many other queries, the Viewer query infers the current user from the access token. This is the simplest way to get the current user.
Viewer
::: info If you only require the user ID, you can use a JWT library to decode the access token and get the user ID from the sub field. :::
sub
Apollo Studioarrow-up-right
query { Viewer { id name } }
Last updated 1 year ago