Skip to content
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

Allow 'self' for personal access token rotation #3547

Merged
merged 2 commits into from Mar 8, 2024

Conversation

nhollander-alert
Copy link
Contributor

Since GitLab 16.101 a personal access token with the api scope can refresh itself by making a call to /personal_access_tokens/:id/rotate with an :id of self2.

Tested with the following script:

import { Gitlab } from "@gitbeaker/rest"
const gl = new Gitlab({token: "glpat-..."});
gl.PersonalAccessTokens.rotate("self").then((rotated) => {
    console.log(`New token is ${rotated.token}, expires at ${rotated.expires_at}`);
});

Footnotes

  1. This feature is available but undocumented from 16.9.

  2. https://docs.gitlab.com/ee/api/personal_access_tokens.html#use-a-request-header

@jdalrymple jdalrymple added the type:feature Changes add a new feature label Mar 2, 2024
@jdalrymple jdalrymple merged commit f2a3420 into jdalrymple:main Mar 8, 2024
2 checks passed
@jdalrymple
Copy link
Owner

🚀 PR was released in 40.0.0 🚀

@jdalrymple jdalrymple added the released This issue/pull request has been released. label Mar 18, 2024
@nhollander-alert nhollander-alert deleted the add-self-token-refresh branch March 19, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released. type:feature Changes add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants