Commit graph

50 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
38d6a83e35
test(auth status): correctly replace JSON-escaped paths
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-25 10:51:47 +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
4449af614c
fix error missing in json output 2025-09-16 23:00:41 +02:00
Benjamin Levesque
3cdd359987
remove showToken from authEntry 2025-09-16 21:57:28 +02:00
Benjamin Levesque
e2df8ac1cc
address copilot comment on parameter order 2025-09-13 22:33:27 +02:00
Benjamin Levesque
5abb467e69
remove includeScope 2025-09-13 21:50:06 +02:00
Benjamin Levesque
b38e12ef61
move flag validation to RunE 2025-09-13 21:30:19 +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
c937e0275d
mutually exclusive flags 2025-08-20 20:02:41 +02:00
Benjamin Levesque
6e6c09e6b1
add ExpectCommandToSupportJSONFields 2025-08-20 19:36:09 +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
c5fc7e3ffb
Fix missing assertions 2025-08-19 22:37:25 +02:00
Andy Feller
03c34e71f9 Expand active test cases 2024-08-30 10:57:51 -04:00
Velmurugan
1eecfd4530 Added --active flag to the gh auth status command 2024-08-24 16:24:51 +05:30
Simon
0a3a12839d
Exit with 1 on authentication failure 2024-07-22 20:22:42 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Sam Coe
80fc413592 Polish auth status timeout error message 2023-12-06 14:06:28 +01:00
Sam Coe
587007a562 Additional auth status tests 2023-12-06 14:06:28 +01:00
William Martin
15ba536317 Ensure subtests use the right t during setup 2023-12-06 14:06:28 +01:00
William Martin
c9a6b7cc00 Always mock the keyring in NewIsolatedTestConfig 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
William Martin
08c7bd1df2 Use real config and login in status tests 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
Kousik Mitra
6fc6b87484
Reword token invalid message (#7906) 2023-08-28 15:12:28 -05:00
rajhawaldar
b8302311fa
Added wantErrOut property 2023-06-15 09:08:06 +05:30
rajhawaldar
437b78a955 Resolve tests/lint errors 2023-06-07 09:21:50 +05:30
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
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
5a110c8e42 Add SSH key generation & uploading to gh auth login flow 2021-02-01 23:34:00 +01:00
Sam Coe
71fd2fa24c
Fix up test 2021-01-22 08:50:09 -08:00
Sam Coe
5e10638b0e
Merge branch 'trunk' into auth-status-fail 2021-01-22 08:46:24 -08:00
Mislav Marohnić
4a2cc8d2a4 Simplify ssh-key list
Do not require nor request `read:public_key` scope by default.
2021-01-20 20:23:57 +01:00
edualb
e26a1b98a1 add ssh-key command 2021-01-20 20:23:38 +01:00
Mislav Marohnić
75ebb863e3 Use testify assertions for error matching 2021-01-19 13:59:37 +01:00
Nilesh Singh
f3fcaf6c9c Fix error message text & add test case 2021-01-17 14:42:49 +05:30
Mislav Marohnić
c39dc28fa1 Rename auth/client to auth/shared 2020-12-07 17:08:42 +01:00
rista404
2bdfc10e0a
Add ability to print auth token 2020-10-11 12:55:34 +02:00
Mislav Marohnić
c80292c2e8 Extend Config object with GITHUB_TOKEN support
Adding GITHUB_TOKEN & GITHUB_ENTERPRISE_TOKEN support orthogonal to
Config was getting out of hand, especially in `auth` commands that
adjust their messaging and error status based on the presence of these
environment variables.

The new approach builds in support for tokens from environment straight
into Config object by composition. Thus, commands need not ever be
concerned with any specific environment variables.
2020-09-07 21:33:26 +02:00
vilmibm
36b2d3f6a7 ensure that config is not written 2020-08-11 16:24:08 -05:00
vilmibm
3a33735da8 be more helpful 2020-08-11 15:58:00 -05:00
vilmibm
ec25b735ab gh auth status 2020-08-11 15:58:00 -05:00