hello! im developing lemmy client (on html5). i tried to do login function but… when i try to fetch /v3/user backend with auth-token it give me error:

{
  "error": "no_id_given"
}

but why? what im doing wrong? if you want here is my source file on github ( function: getLoggined() )

  • Andrew@piefed.social
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 days ago

    I see this has already been answered, but I’ll post what I was typing out anyway.

    It’s not enough to just provide your auth token if you want to fetch the details for yourself (even though the JWT decodes to identify you). You have to use /user like you would for fetching anyone else, e.g.:

    curl --header 'accept: application/json' --header 'authorization: Bearer xyzyzyz' --location https://lemmy.world/api/v3/user?username=okelote360 | jq .