Retrieve users private token with Gitlab python API

Viewed 1102

I am trying to retrieve all users' private token and SSH keys with gitlab API (v4) using an admin private token in my curl requests.

I can get a user SSH key by running the following command :

curl --header "PRIVATE-TOKEN: my_admin_token" "https://gitlab.my_gitlab.com/api/v4/users/user_id/keys"

But I can't find a similar way to get his private token (I need it for further applications in a python script). How can I do that ?

2 Answers

It seems that it is impossible. When you create token you need to save it since you cannot access it later (see attached screenshot):

enter image description here

Related