-
Notifications
You must be signed in to change notification settings - Fork 671
Project Access Token self rotate API correct usage #3203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This has been fixed in #3196 It should be in the next release which will happen in a few days. |
Oh, I checked the issues but not the PRs. Thank you very much! |
You're welcome. FYI: Releases happen on the 28th of each month. So in 5 days should be the next release. |
Hi! I am looking to use the rotate API, we have upgraded to GitLab 18 and the python-gitlab rotate seems to have broken. I see there's still a release due out with this fix. Does the issue affect all token rotation, or only self-rotation? We are getting 401 unauthorized for jobs that previously rotated successfully - they use a group admin token, not a self-rotate privilege, but I see there hasn't been a python-gitlab release in some time, so I guess I might be suffering from a different form of the same issue. Should I open a separate issue? (I would love to test the updated module from the main branch, this is a sandbox environment, but I am new at Python and not sure how!) Edit: I think I have tested with the latest @ main branch:
Is this possibly related? The admin token I'm using has |
As a note the automatic release didn't run. But I have manually triggered it. And also re-enabled it to run on the automated schedule. Please give it a try now with the latest release. |
Thanks for this issue, I was able to configure self-rotate with the new 6.0.0 and it appears to be working now You did it! 🎉 🌮 🏆 |
Glad it works 👍 |
Description of the problem, including code/CLI snippet
I'm trying to self-rotate a Project Access Token. I log in to Gitlab, get the project from
namespace/project
and get a list of all the project access tokens. Then I filter them by name (unique client name) and not revoked status. The token variable is populated as expected. Then I try to rotate it:This is the execution log (masked values with < >):
As you can see from the logs the token has full permissions and maintainer role to exclude a permissions issue.
From the gitlab api documentation, the URL has to have this form
https://gitlab.example.com/api/v4/projects/<project_id>/access_tokens/self/rotate
where
self
is in place of the <token_id>.In your documentation I could not find a way to self rotate a Project Access Token with itself and it would be very useful. I've tried
token.rotate(self_rotate=True)
like with Personal Access Tokens with no avail. It only adds a GET parameter to the petition but still uses <token_id> instead ofself
.When I make an api call using curl I encounter the same behaviour with <token_id> but works as expected with the
self
keyword:Expected Behavior
The token is rotated with
self
keyword.Actual Behavior
The python-gitlab library uses the rotate API call for a specific PAT with id:
api/v4/projects/<project_id>/access_tokens/<token_id>/rotate
no matter what code I use.Specifications
The text was updated successfully, but these errors were encountered: