Can't make api/user work with a token
-
Hello,
I'm trying to get my users by email in my project.
But i can't access to the api/user fonctionnality.I created a token for the user _uid = 1, the admin of the forum in : /admin/settings/api.
When i try the "unread" and the "users" fonctionnalities, all works fine but on "user", my request is not authorized.There is my test commands :
curl https://lestribunes-dev.unitedmanagers.com/api/unread -H "Authorization: Bearer 5dfa7696-a8dd-4e6b-8806-2afba838ab12" => WORKS !
curl https://lestribunes-dev.unitedmanagers.com/api/users -H "Authorization: Bearer 5dfa7696-a8dd-4e6b-8806-2afba838ab12" => WORKS !
curl https://lestribunes-dev.unitedmanagers.com/api/user/uid/10300 -H "Authorization: Bearer 5dfa7696-a8dd-4e6b-8806-2afba838ab12" => "status":{"code":"not-authorised","message":"Aucune session de connexion valide trouvée. Veuillez vous connecter et réessayer."}
curl https://lestribunes-dev.unitedmanagers.com/api/user/email/[email protected] -H "Authorization: Bearer 5dfa7696-a8dd-4e6b-8806-2afba838ab12" => {"status":{"code":"not-authorised","message":"Aucune session de connexion valide trouvée. Veuillez vous connecter et réessayer."}
If someone have an idea how resolve this, please let me know.
Thanks in advance. -
Well i found a solution with the users query :
const axiosInstanceForNativeAPI = axios.create({ baseURL: ENDPOINT_URL, headers: { Authorization: ADMIN_TOKEN_FOR_NATIVE_API }, }); export const getUserByEmail = email => axiosInstanceForNativeAPI.get(`/users?searchBy=email&query=${email}`); export const getUserByUsername = username => axiosInstanceForNativeAPI.get(`/users?searchBy=username&query=${username}`);
-