Commit graph

40 commits

Author SHA1 Message Date
Babak K. Shandiz
5685b9a443
refactor(auth refresh): use PlainHttpClient instead of zero http.Client
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-13 16:51:13 +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
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
William Martin
0763c1d4a7 Locally prevent mixup of username and token in refresh 2023-12-07 11:43:05 +01:00
William Martin
16cfe5f21a Fix token username return ordering in auth refresh 2023-12-07 11:35:02 +01:00
Sam Coe
fd7dc25e2a
Add error to auth refresh when active user does not match newly authenticated token user 2023-12-06 16:51:48 -04:00
William Martin
ecfb226d5d Fix linting errors 2023-12-06 14:06:28 +01:00
William Martin
748d59ec64 Use real config in auth refresh tests 2023-12-06 14:06:28 +01:00
Sam Coe
5e2e818204
Small tweaks to auth refresh remove-scopes and reset-scopes flags (#7631) 2023-06-27 16:33:52 +09:00
Nilesh Singh
0ddf32d589 Add cli test to remove multiple scopes at once 2023-06-26 23:52:55 +05:30
Nilesh Singh
becccebae1 Refactor as per review
Co-authored-by: Shion Ichikawa <shion1305@gmail.com>
2023-06-25 01:30:09 +05:30
Nilesh Singh
0d9e0bc91a Add remove/reset to auth refresh 2023-06-19 21:56:15 +05:30
nate smith
75dc9c0c22 extend secure storage default to auth refresh 2023-04-04 15:22:42 -07:00
Sam Coe
b74ba55e3f
Make auth refresh more convenient with secure storage (#7098) 2023-03-08 10:19:42 +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
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
vilmibm
8f3032af36 use Prompter in auth commands 2022-09-13 13:22:50 -07:00
vilmibm
41385477c3 fix linting 2022-07-27 14:15:27 -05:00
vilmibm
d5334f4115 Revert "update linter checks"
This reverts commit 40ecb8c188.
2022-07-27 13:30:41 -05:00
vilmibm
40ecb8c188 update linter checks 2022-07-26 16:06:52 -05: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ć
e43cb2b880 Port more legacy stubs to the new ask stubber 2022-01-14 19:34:15 +01:00
Mislav Marohnić
8198cce59b
Merge pull request #3997 from nicknotfun/non-interactive-auth
Add interactive mode to auth flow, pass from login and refresh

Closes #4506
2022-01-12 15:59:30 +01:00
Nick Cooper
a408f24d3a auth: add noninteractive flow to login/refresh 2022-01-11 22:44:46 +01:00
Mislav Marohnić
3cce16e72d Refactor factory.Executable() to be a method rather than a func
This way, factory can satisfy an interface that requires `Executable()`.
2021-12-21 13:50:55 +01:00
Mislav Marohnić
89ad870190 auth refresh: preserve existing scopes when requesting new ones
When there was a previously valid token that was granted some scopes,
ensure all those scopes will be re-requested when doing the
authentication flow for the new token.
2021-10-14 19:52:59 +02:00
Mislav Marohnić
d853ce5bc9 Avoid resolving executable() until requested at runtime
This is to avoid hitting the filesystem and resolving symlinks
unnecessarily. The value of executable is just used conditionally by a
handful of commands.
2021-09-24 14:42:41 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
75ebb863e3 Use testify assertions for error matching 2021-01-19 13:59:37 +01:00
Mislav Marohnić
38ea595ce2 Fix refresh test 2020-12-07 20:07:20 +01:00
vilmibm
a2aa154794 port entirely to ColorScheme 2020-10-29 12:37:45 -07:00
vilmibm
4d3e26e927 prompts disabled test for auth refresh
the behavior for nontty vs. prompts disabled is pretty different so i
opted for a new test, here
2020-09-10 13:19:43 -05:00
vilmibm
c0fc31f7d5 use CanPrompt in commands 2020-09-10 12:13:48 -05: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
2f1e9ecc7a review feedback 2020-08-12 12:06:14 -05:00
vilmibm
f1c0d04bc0 gh auth refresh 2020-08-12 12:05:27 -05:00