aws / aws/amazon-q-developer-cli
bug: Headless login fails on Mac
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again
### Operating system
MacOsx (Sequoia)
### Expected behaviour
`q login` should work on a headless SSH session
### Actual behaviour
When trying to login with `q login` using a headless SSH session to my Mac - it fails on the OIDC call to `CreateToken` - I traced this back through the code-path and found that the `device_registration` is not persisting properly to the `secret_store`, when this [line](https://github.com/aws/amazon-q-developer-cli/blob/0497da7b6443481f2a1de28a132e94b4ed20b4e4/crates/fig_auth/src/builder_id.rs#L198) runs, an error is thrown :
```
SecKeychainItemModifyContent: User interaction is not allowed
```
As a result, the polling call for create-token creates a new client-registration - which obviously results in a `client_id` / `client_secret` that doesn't match the original call to `StartDeviceAuthorization` call - and the service errors. This effectively means I can't login to Q in headless mode.
### Steps to reproduce
(On Mac)
1. `ssh localhost`
2. `q login`
### Environment
```yaml
```
Contributor guide
Assessment
This issue has not been assessed yet.