Search code examples
apigitlabaccess-tokengitlab-api

How do I track the origin of a token in Gitlab?


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?


Solution

  • 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.