API: project access token API does not support self token_id

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

API: project access token API does not support self token_id

Steps to reproduce

This works:

curl -X GET -H "PRIVATE-TOKEN: glpat-xxxxxxxxx" https://gitlab.example.com/api/v4/projects/yyy/access_tokens/123

This does not work (despite what the doc says at https://docs.gitlab.com/api/project_access_tokens/#get-details-on-a-project-access-token)

curl -X GET -H "PRIVATE-TOKEN: glpat-xxxxxxxxx" https://gitlab.example.com/api/v4/projects/yyy/access_tokens/self

output :

{"message":"404 Could not find project access token with token_id: self Not Found"}

Note that the private-token is the one with id 123 in above example.

What is the current bug behavior?

self seems to be not recognized by REST API.

What is the expected correct behavior?

self token_id should extracts actual token_id from private-token.

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:		Debian 11
Current User:	git
Using RVM:	no
Ruby Version:	3.2.5
Gem Version:	3.6.3
Bundler Version:2.5.11
Rake Version:	13.0.6
Redis Version:	7.0.15
Sidekiq Version:7.2.4
Go Version:	unknown

GitLab information
Version:	17.9.1
Revision:	073f7efc655
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	14.15
URL:		https://gitlab.example.com
HTTP Clone URL:	https://gitlab.example.com/some-group/some-project.git
SSH Clone URL:	git@gitlab.example.com:some-group/some-project.git
Using LDAP:	yes
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.40.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	17.9.1
- default Git Version: 	2.47.2

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 14.40.0 ? ... OK (14.40.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell-check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished

[snip] All check passed [snip]

Active users: ... 118 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Checking GitLab App ... Finished Checking GitLab subtasks ... Finished

Edited by 🤖 GitLab Bot 🤖