Repository navigation
feat(jira): tell how to replace a token that Jira refuses - #44
Merged
Merged
Conversation
Jira's API answers 401 Unauthorized when the credentials are incorrect or missing, as they are once a token expires, which a scoped token does within a year. baton jira now names the email that Jira refused and gives the command that replaces the token in the keychain, `security add-generic-password -U`, with the email quoted for the shell. The client marks a 401 to the gateway's logged-in requests as a LoginError. The site's 401, to the cloud ID's request without the login, stays unmarked, since no token caused it. The user chose to skip a live check of Jira, so fact 41 now says that whether tenant_info answers without a login stays unchecked. Plan row 66 is done.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



When Jira refuses the login,
baton jiranow names the email and gives the command that replaces the token. A scoped token expires within a year (fact 42), so every user will hit this. This is plan rowjira-login, a follow-up to #43.What
Client:
jira.LoginErrormarks a 401 Unauthorized to the gateway's logged-in requests (the issue and its comments). Jira's API gives 401 when the credentials are "incorrect or missing" (the OpenAPI spec of fact 40). The error's text is unchanged. The site's 401, to the cloud-ID request that carries no login, stays unmarked, since no token caused it.baton jira: for a LoginError, it prints:Jira's answer sits in parentheses, since the gateway's own text can hold a semicolon or a colon. The email in the command is quoted for the shell.
Docs:
baton jiragives the-Ucommand.jira-login. Decision 60 covers the 401.read the cloud ID of <site>:and the site's answer.Checks
mise run check: green; coverage 99.5% in total.!login, 403, any status, never, unmarked) and 4 in the cli, run against both wordings. A%w→%vin the cli hint would survive: nothing unwraps that error; it only gets printed.cli.Run, wired as main.go is, against a local fake Jira, with a temp HOME and config and no tmux. The real binary can't reach a 401 without a real Jira. Results:'o'\''nobody@example.com'quoted.read the cloud ID of example.atlassian.net: 401 Unauthorized: …with no hint.