Invalid token when using glab changelog generate command

Hello. I want to use Gitlab built-in feature for changelog generation.

We use privately managed Gitlab and currently its running on old version (15.11).

I have read the following:

and in my repository, I am trying to execute command: glab changelog generate

However, the command returns :

C:\Users\test.lu\Desktop\WORK\gitchangelog-test\my_project>glab changelog generate
GET https://xxx-gitlab.xxxxxxx.lt/api/v4/projects/embeded-programmers/gitchangelog-test: 401 {error: invalid_token}, {error_description: Token is expired. You can either do re-authorization or token refresh.}

I can see the changelog by typing the url in the browser, for example:

https://xxx-gitlab.xxxxxxx.lt/api/v4/projects/121/repository/changelog?version=2.2.0

and I will get a bunch of changes:

{"notes":"## 2.2.0 (2024-01-17)\n\n### changed\n\n \n- [changed](embeded-programmers/gitchangelog-test@76ec96be596937e900a81de1689325bafef88297) \n \n- [Update CI/CD pipeline](embeded-programmers/gitchangelog-test@62fdc22515f23e5f7b2da0b2c332cdb8bd0547d5) \n \n- [Changed project name in CMake](embeded-programmers/gitchangelog-test@e324ac868bd83888080e76f37066fb584a19caa3) \n \n- [Changed pipeline](embeded-programmers/gitchangelog-test@d2e9f38d07fa3ead5e197dc3205baa928639663d) \n \n- [Changed pipeline](embeded-programmers/gitchangelog-test@70ccdb00719a05be16ba2b96eeeaf97f8385d856) \n \n- [change1](embeded-programmers/gitchangelog-test@dea1664b4d8c6ca8c7f230a79645fcf323b10f70) \n \n- [another new feature for 2.8.0](embeded-programmers/gitchangelog-test@66d2f48e348bb9fc65a92647cb24f1f301fcbb4c) \n\n### added\n\n \n- [Feature for 5.1.0](embeded-programmers/gitchangelog-test@214fe1e9ba91798d3bea42df300bb8b7fdbf9baf) \n \n- [This is my commit message](embeded-programmers/gitchangelog-test@73ce8dae7696fa65bb7b78582c4023034f60516c) \n \n- [random stuff](embeded-programmers/gitchangelog-test@a8fc75c100572bf6093a1e9f95fbf77ced590b98) \n \n- [Another commit using fork](embeded-programmers/gitchangelog-test@9889ae912d162ca546813aea108a531c4ebfa2c5) \n \n- [Added feature using Fork Changelog: added](embeded-programmers/gitchangelog-test@faa951e4f07ef31d0a4abb419406f4c9aaed5a40) \n \n- [Commit with trailer using command line](embeded-programmers/gitchangelog-test@d2bc0ad1d9ed32620de239e93170f426b251cfde) \n \n- [added feature](embeded-programmers/gitchangelog-test@6744c0cd3bc3d3e7d834b557d58804d04a514f8e) \n \n- [added2](embeded-programmers/gitchangelog-test@e4fe829d43b83c0a16c13e8791055338f3e4e13a) \n \n- [added1](embeded-programmers/gitchangelog-test@709736d76d0f888aee49a735b68a4ac51649b989) \n \n- [modified ci script to add job id](embeded-programmers/gitchangelog-test@de2babcc4c101504364949f72a38c355a6db2e18) \n \n- [adding trailer via cmd line](embeded-programmers/gitchangelog-test@5263ee4c0520fc050ef8bb4831a79652f3b8f3cf) \n \n- [random shit feature completed](embeded-programmers/gitchangelog-test@89164b648f1c6323fe6c456371d2aa9ed2bc843d) \n \n- [temperature measurements supports new sensor](embeded-programmers/gitchangelog-test@3e2c90e7f565f155f3af832974ad3ac0ab5bb134) \n \n- [new feature for 2.9.0](embeded-programmers/gitchangelog-test@905551aaea9a18b9cb00a2db00abf85e271a7bb0) \n \n- [new feature for 2.8.0](embeded-programmers/gitchangelog-test@963d2ac95643e029fdd51464d884276c956dba24) \n \n- [added another feature for 2.4.0](embeded-programmers/gitchangelog-test@d6f9edabaf7e25a5c571f4b3f8a50db3209a943b) \n \n- [added feature for 2.4.0](embeded-programmers/gitchangelog-test@faf18edae9d3336b96f97aea5bd9a8558bc25ce2) \n \n- [another new feature for 2.3.0](embeded-programmers/gitchangelog-test@e78e3550505b7eeabf5483c7613ff92c9ad3bd5c) \n \n- [new feature for 2.3.0](embeded-programmers/gitchangelog-test@5b0b425b92c8cea49b34ad3fbd8f9a8572e47d6e) \n \n- [cat release notes](embeded-programmers/gitchangelog-test@74047d7e7a42c1aa90d84a59557507a3e117f607) \n\n### removed\n\n \n- [Adding commit using Git Extensions](embeded-programmers/gitchangelog-test@56e0b94f926b5cfbf200796f1c841d12a425540b) \n \n- [removed1](embeded-programmers/gitchangelog-test@7e84009dd196408a6cf99bf7610b6e55c34e971f)\n"}

I just dont understand why would I not be able to do the same using glab changelog generate command

I have tried to find information about this but could not find anything. I have many questions such as:

  1. Is it refering to project access token or personal access token?
  2. How can I refresh or re-authorizate token?
  3. How can I check what token is currently being used?
  4. How can I setup new token? (I have tried to create personal access token and project access token but not sure what to do after generating tokens? Do I need to assign them somehow? Because simply creating token did not fix the issue.

Appreciate any help, thanks in advance.

The GitLab CLI documentation provides an overview of commands, including auth which has a sub command for checking the status. To re-authorize, you can either use interactive (will open a browser window), or token based login.

When accessing an HTTP GET API URL in your browser, it automatically reuses the logged-in GitLab session and its permissions. You can verify that by acessing the user endpoint https://gitlab.com/api/v4/user which is only visible to you with your data (and to admins).