Commit graph

85 commits

Author SHA1 Message Date
Fredric Silberberg
a656271f26 Print gh auth refresh for 401 returns
`gh auth refresh` exists to make it simpler for users to refresh their tokens on expiration/scope mismatch, but help messages only suggest using it in limited scenarios, and not in a common case of a token expiring and the user receiving a 401 error. Now, the auth flow will detect this case, and for refreshable tokens (namely, tokens created by logging in with `gh auth login` in the first place), it will suggest using `gh auth refresh` for these cases.
2026-04-20 12:07:14 -06:00
Babak K. Shandiz
365ca1a901
refactor(auth login): use PlainHttpClient for OAuth flow
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-13 16:51:11 +01:00
Andrey
4e1318eb2a
feat: gh auth Automatically copy one-time OAuth code to clipboard (#11518)
* feat: add ability to copy one-time OAuth code while authenticating

Signed-off-by: Andrey <andrekabatareika@gmail.com>

* fix(docs): wrong example for gh auth refresh

* chore(authflow): update message to include one-time code to it

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>

* chore(authflow): improve message when copied one-time code

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>

* chore(authflow): don't early return error when could not copy OAuth code

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>

* refactor(authflow): make code for working with OAuth code more readable

* Adjust language in `gh auth` help for clipboard

---------

Signed-off-by: Andrey <andrekabatareika@gmail.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-08-25 09:52:51 -06:00
Caleb Brose
940560acf2
Fix ssh directory 2024-11-06 16:13:29 +00:00
William Martin
a37253746e Remove TODO and add comment on LoginFlow tests 2024-05-17 14:51:02 +02:00
William Martin
3fe555b0bb Comment the purpose of the helper config contract 2024-05-17 14:33:19 +02:00
William Martin
540bda1a6b Test git credentials are configured in LoginFlow 2024-05-17 14:31:21 +02:00
William Martin
ba1afa2c5d Add HelperConfig contract test and FakeHelperConfig 2024-05-17 14:16:14 +02:00
William Martin
3ea937d903 Inject GitCredentialFlow to LoginFlow as test seam 2024-05-17 13:26:23 +02:00
William Martin
3803fd04b9 Add Helper test for Windows 2024-05-16 17:01:41 +02:00
William Martin
64d50e6fbc Add tests for gitcredentials Updater 2024-05-16 15:37:18 +02:00
William Martin
37abb3ec96 Fix mistaken git installation error check 2024-05-16 14:38:51 +02:00
William Martin
e07a26d81c Move gitcredentials HelperConfig and add tests 2024-05-16 14:34:28 +02:00
William Martin
d75548a630 Comment the new gitcredentials package 2024-05-16 13:48:53 +02:00
William Martin
187c5016f0 Comment the git credential flow 2024-05-16 13:39:42 +02:00
William Martin
818d4ba5b8 Remove unnecessary credential setup private method 2024-05-16 13:39:42 +02:00
William Martin
177cf7d35b Rename gitcredentials Configure to ConfigureOurs 2024-05-16 13:15:26 +02:00
William Martin
bd4ba5c39a Make gitcredential helper smarter 2024-05-16 13:15:26 +02:00
William Martin
af589aa2f3 Move fetching configured helper into gitcredentials 2024-05-16 12:39:11 +02:00
William Martin
a3d65e0dce Extract units for configuring and updating git credential helpers 2024-05-16 12:32:55 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Nero Blackstone​
93113e12ea
Add colon at the end of secret prompts (#9004) 2024-04-26 12:58:45 +02:00
Babak K. Shandiz
1992fdeb1a
Use filepath.Join to support different platforms
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-14 00:09:53 +01:00
Babak K. Shandiz
a269032fd3
Refactor into table tests
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-13 21:13:12 +01:00
Babak K. Shandiz
0a77c56c44
Add test to verify skipped SSH key prompts
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-06 12:47:09 +01:00
Babak K. Shandiz
3a3450fec5
Add SkipSSHKey field to LoginOptions
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-06 12:45:26 +01:00
Sam Coe
024cb939af Rename authCfg.Token to authCfg.ActiveToken and authCfg.SetToken to authCfg.SetActiveToken 2023-12-06 14:06:28 +01:00
Sam Coe
8cdbc1a8ca Refactor authCfg.UsersForHost to not return an error 2023-12-06 14:06:28 +01:00
William Martin
2c72647cf7 Update git protocol login prompt to indicate it is host level 2023-12-06 14:06:28 +01:00
William Martin
1bf6023164 Display message when logging into existing account 2023-12-06 14:06:28 +01:00
William Martin
9efa7248a9 Initial multi-account migration work 2023-12-06 14:06:28 +01:00
Keith Bailey
97755c6bf0
Document when gh auth login writes oauth token to plain text (#7781) 2023-09-18 11:34:13 +02:00
Jamie Tanna
e4cddb562e
Remove GHE handling for workflow scope (#7841)
According to [0] we appear to no longer support GHE 2.x, as the latest
release was deprecated in early 2022.

We can therefore remove this custom handling.

[0]: https://docs.github.com/en/enterprise-server@3.7/admin/all-releases
2023-08-15 17:40:09 +00:00
vaindil
7006d3f0a5 move SSH key errors out of upload function 2023-03-31 13:47:25 -04:00
vaindil
f21f1ca4ef check SSH key existence before uploading 2023-03-29 17:32:25 -04:00
Sam Coe
50ddb369a6
Manually get current user name rather than use api client (#7114) 2023-03-09 11:50:12 +11:00
Sam Coe
df83dc2d58
Add ability to store tokens in encrypted storage (#7043) 2023-02-28 00:04:53 +00:00
Sam Coe
a33e12a21d
Refactor Config interface in preperation for encrypted token storage (#7033) 2023-02-28 10:51:12 +11:00
Ariel Deitcher
a5edd8f542
show token scopes on auth status (#6546)
- show path to config file
- display token prefix
- refine how missing scopes are shown

Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
Co-authored-by: Mislav Marohnić <mislav@github.com>
2023-01-25 16:25:00 +01:00
Mislav Marohnić
ba028b9044 Fix setting up git credential helper on Windows 2022-11-02 15:53:26 +01:00
Sam Coe
4294ee14a1
revert revert 57fbe4f317 (#6474) 2022-10-20 12:17:20 +00:00
Sam Coe
2cefb9fa59
Fix pr create regression (#6472)
* Revert "Refactor to use new git client (#6447)"

This reverts commit 57fbe4f317.

* Fix pr create regression
2022-10-20 12:46:23 +03:00
Sam Coe
57fbe4f317
Refactor to use new git client (#6447) 2022-10-19 21:11:36 +03:00
Sam Coe
2944f7c3ab
Create git client (#6354) 2022-10-14 07:47:03 +00:00
vilmibm
8f3032af36 use Prompter in auth commands 2022-09-13 13:22:50 -07:00
Sam Coe
6955db471d
Set default value for all Select prompts (#6131) 2022-08-24 09:10:38 +03:00
vilmibm
2d093c1741 add test helpers 2022-08-15 13:53:43 -05:00
vilmibm
e1238015f5 linter appeasement 2022-07-26 16:45:28 -05:00
vilmibm
f7d5c5f725 move prompter to own package 2022-07-26 16:41:13 -05:00
vilmibm
4afb567d06 WIP: survey wrapper 2022-07-26 14:39:38 -05:00