Trouble with Gitlab API emails endpoint

Hi,
I’m using a Gitlab OAuth app to authenticate users and then calling APIs to get information about members/users within a group. I’m having trouble accessing the email addresses or at least the public email addresses of users. I get 403 forbidden when I try to access email addresses of other users and an empty array when I try to access the email addresses of the authenticated user.

curl --header “PRIVATE-TOKEN: ***************” “https://gitlab.com/api/v4/users/6025455/emails

curl --header “PRIVATE-TOKEN: ***************” “https://gitlab.com/api/v4/users/emails

curl --header “Authorization: Bearer *********************************************” “https://gitlab.com/api/v4/user/emails

curl --header “Authorization: Bearer *********************************************” “https://gitlab.com/api/v4/users/6025455/emails

I understand that the /users/:id/emails API is restricted to admins. Is this admin the admin of a group? Or an admin of the self-managed Gitlab instance?

But in any case, is it possible to get public email address of a user that is a member of your group? Any help will be much appreciated. Thank you in advance.

Hi,

Since GitLab.com is the same product as the self-hosted instance, this is the instance admin. For GitLab.com that’s our infrastructure team but no-one else got access. I cannot access that either.

A previous question makes me believe that users can be fetched, and you should see their email attribute then when set to public.

Cheers,
Michael

2 Likes