Commit graph

71 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
e31136a677
docs(auth status): explain --json will always exit with zero
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-23 15:42:25 +01:00
Babak K. Shandiz
5fddcef0a8
fix(auth status): return JSON entries under hosts
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-23 15:24:37 +01:00
Benjamin Levesque
914531e6f1
fixup! examples 2025-09-16 23:07:11 +02:00
Benjamin Levesque
4449af614c
fix error missing in json output 2025-09-16 23:00:41 +02:00
Benjamin Levesque
5bb76e832b
examples 2025-09-16 22:00:07 +02:00
Benjamin Levesque
3cdd359987
remove showToken from authEntry 2025-09-16 21:57:28 +02:00
Benjamin Levesque
5ae0410bd2
add examples 2025-09-13 22:25:20 +02:00
Benjamin Levesque
a69f7a6b53
simplify exporter usage 2025-09-13 22:14:59 +02:00
Benjamin Levesque
5abb467e69
remove includeScope 2025-09-13 21:50:06 +02:00
Benjamin Levesque
54bf8432f6
do not mutate opts.ShowToken 2025-09-13 21:35:02 +02:00
Benjamin Levesque
60088e0e7d
move displayToken to String method 2025-09-13 21:30:20 +02:00
Benjamin Levesque
b38e12ef61
move flag validation to RunE 2025-09-13 21:30:19 +02:00
Benjamin Levesque
45ecc5ece9
introduce AddJSONFlagsWithoutShorthand 2025-08-31 17:56:52 +02:00
Benjamin Levesque
78675e73e1
fix show token when using json 2025-08-20 21:01:31 +02:00
Benjamin Levesque
48bc79a291
fix exit code 2025-08-20 20:26:27 +02:00
Benjamin Levesque
085f31fed8
revert showToken change 2025-08-20 20:07:57 +02:00
Benjamin Levesque
c937e0275d
mutually exclusive flags 2025-08-20 20:02:41 +02:00
Benjamin Levesque
faa0e2c26b
flag duplicate check 2025-08-20 20:02:00 +02:00
Benjamin Levesque
3d02e248c0
do not export authState 2025-08-20 17:50:29 +02:00
Benjamin Levesque
96755eec83
handle -t conflict 2025-08-20 09:05:20 +02:00
Benjamin Levesque
3ffe199ef3
do not fetch scope if not necessary 2025-08-20 01:04:09 +02:00
Benjamin Levesque
8b553d66cc
json flags 2025-08-20 00:27:31 +02:00
Benjamin Levesque
fd19da8e55
auth state enum 2025-08-19 23:43:22 +02:00
Benjamin Levesque
0091384495
Refactor entry to a single type 2025-08-19 22:54:31 +02:00
Velmurugan
1eecfd4530 Added --active flag to the gh auth status command 2024-08-24 16:24:51 +05:30
Stausssi
e7606363fb
document exit code behavior 2024-07-22 20:36:22 +02:00
Simon
0a3a12839d
Exit with 1 on authentication failure 2024-07-22 20:22:42 +02:00
William Martin
07e0ff7127 Fix repo fork to use remote protocol if none configured 2024-05-10 10:48:36 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
William Martin
4ca098b0c9 Adjust short and long to be the same 2024-05-01 14:17:08 +02:00
William Martin
5a5b04d132 Document relationship between host and active account 2024-05-01 11:14:00 +02:00
Josh Soref
6ff355049c
Improve discovery of gh auth status 2024-03-18 12:09:27 -04:00
Sam Coe
80fc413592 Polish auth status timeout error message 2023-12-06 14:06:28 +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
1a3392a379 Rename authCfg.User to authCfg.ActiveUser 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
Sam Coe
e806664ef7 New UX for auth status 2023-12-06 14:06:28 +01:00
Sam Coe
760dc91faa Include environment variable users in auth status output 2023-12-06 14:06:28 +01:00
William Martin
b2997cc7bd Handle multi account golden path in auth status 2023-12-06 14:06:28 +01:00
William Martin
e4ed4041cd Use auth config and only print stdout in status 2023-12-06 14:06:28 +01:00
William Martin
5d10beb60a Use config to look up user for status 2023-12-06 14:06:28 +01:00
Mika
2f31607096
Add timeout error in gh auth status (#8337) 2023-11-29 08:54:55 +00:00
Sam Coe
7924878315
Fix git protocol and refactor Config interface (#8246) 2023-10-27 15:42:05 +02:00
William Martin
7d8c1af009 Fix GitProtocol signature and rework test descriptions 2023-10-19 12:49:38 +02:00
Kousik Mitra
6fc6b87484
Reword token invalid message (#7906) 2023-08-28 15:12:28 -05:00
rajhawaldar
437b78a955 Resolve tests/lint errors 2023-06-07 09:21:50 +05:30
rajhawaldar
69c02b9b8a update gh auth status to write to stdout on success 2023-06-06 23:30:16 +05:30
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