8

Given a gitlab project/group access token, how do I find out the name of the token and from which group/project it came from?

Uri H
  • 523
  • 1
  • 3
  • 7
  • I have the same query - but for a token that only has access to the `read_registry` permission. It doesn't have access to the API that would then work with `Uri H`'s answer. :-/ – zaTricky Apr 17 '23 at 15:00

1 Answers1

9

You can use the user api such as:

wget --header "PRIVATE-TOKEN: <TOKEN>" https://www.gitlab.com/api/v4/user

Though this API you'll get the user that token is attached to. If the token is attached to a group or a project, you'll see the type and project/group ID in the results.

Uri H
  • 523
  • 1
  • 3
  • 7