help me with /user backend! (lemmy api v3)

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() )

5 points · 3 comments · view on lemmy.world

3 Comments

bleistift2@sopuli.xyz · 1 pts · 1y (2 replies)

Could you provide a link to the documentation for the endpoint you want to access? I can’t find it. My guess is that you need to fetch a specific user via ${api}/user/124356.

Docs here. My guess is wrong.

God, that documentation is annoying to read. I revise my revised opinion. Try providing a user ID or a username as query parameters in your API call.

const response = await fetch(`${api}/user?person_id=123456`, {
    method: "GET",
    headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${lemmyToken}`
    }
});
okelote360@lemmy.world · 0 pts · 1y (1 reply)

now it give me data of someone but not about loggined account...

bleistift2@sopuli.xyz · 1 pts · 1y

You need to provide the user ID (or username) of the account you want to fetch in the query parameters.