-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
feat: error checking for initial API token call #1080
Conversation
Hey @MrGiga! 👋 Thank you for your contribution to the project. Please refer to the contribution rules for a quick overview of the process. Make sure that this PR clearly explains:
With submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this LICENSE. The following ChatOps commands are supported:
Simply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command. This message was generated automatically. You are welcome to improve it. |
Code is slightly incomplete due to the following:
|
https://docs.gitlab.com/ee/api/rest/#sudo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing. This makes the debugging of the registration process easier.
🤖 I have created a release *beep* *boop* --- ## [7.4.0](7.3.1...7.4.0) (2024-02-15) ### Features * error checking for initial API token call ([#1080](#1080)) ([6b3740a](6b3740a)) ### Bug Fixes * rename `pull_policies` to `pull_policy` in `config.toml` ([#1084](#1084)) ([df39014](df39014)) * repair errors in startup shell script ([#1087](#1087)) ([9b7c465](9b7c465)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: cattle-ops-releaser-2[bot] <134548870+cattle-ops-releaser-2[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
If the API token is invalid or expired, the current implementation does not return that error to inform the end user. This implementation adds error checking, returns that error and then does not continue. This should make debugging much easier compared to it's current state. From my research there are two possible error formats.
First error response: 401 unauthorized
{"message":"401 Unauthorized"}
Second possible error response: Token has expired
{"error":"invalid_token","error_description":"Token is expired. You can either do re-authorization or token refresh."}
Migrations required
None
Verification
Provide a bad or expired API token to the module. It should fail and output the reason for failure.