BBS: An invalid PAT should surface a user friendly error
- Dominant language
- C#
- Stars
- 478
- Forks
- 146
- Avg merge
- 7d 21h
- Merged PRs (30d)
- 2
Description
## Description
Both an invalid PAT and a PAT that does not have enough permissions will return a 401 error.
Currently for both we get the following error:
```
[2023-10-18 08:21:28] [INFO] You are running the latest version of the bbs2gh extension [v1.2.1]
[2023-10-18 08:21:28] [INFO] BBS SERVER URL: https://test-bbs-o.githubapp.com/
[2023-10-18 08:21:28] [INFO] BBS PROJECT: IM
[2023-10-18 08:21:28] [INFO] BBS REPO: test-commit-id-blank-review
[2023-10-18 08:21:28] [INFO] SSH PORT: 22
[2023-10-18 08:21:28] [INFO] VERBOSE: true
[2023-10-18 08:21:28] [DEBUG] HTTP POST: https://test-bbs-o.githubapp.com/rest/api/1.0/migration/exports
[2023-10-18 08:21:29] [DEBUG] HTTP BODY: {"repositoriesRequest":{"includes":[{"projectKey":"IM","slug":"test-commit-id-blank-review"}]}}
[2023-10-18 08:21:29] [DEBUG] RESPONSE (Unauthorized): {"errors":[{"context":null,"message":"Authentication failed. Please check your credentials and try again.","exceptionName":"com.atlassian.bitbucket.auth.IncorrectPasswordAuthenticationException"}]}
```
It would be nice to surface a user friendly error noting the correct perms needed.
## Reproduction Steps
export BBS_USERNAME=unit-test
export BBS_PASSWORD="fake-pat" OR "correct pat with not enough perms"
export AWS_REGION=us-west-1
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
`gh bbs2gh migrate-repo --bbs-server-url https://test-bbs-o.githubapp.com/ --bbs-project IM --bbs-repo test-commit-id-blank-review`
Contributor guide
Research direction
Start at the `gh bbs2gh migrate-repo` command and trace how the BBS 401 response is handled. Reproduce the issue with an invalid PAT and a PAT lacking permissions, then verify that the CLI reports a user-friendly message describing the required permissions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- authentication, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100