Current user for private Gitlab Pages in gitlab.io

Current user for private Gitlab Pages in gitlab.io

Hi, is there any API to be used with Javascriot fetch, so that to get the current logged in user for a private static website located at https://group-name.gitlab.io/project-name/?

I have tried with https://gitlab.com/api/v4/user, but I got 401 Unauthorized.

Thanks a lot,
Claudius