Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Streamline renewal of gh auth token #8846

Description

@jonathan-enf

Describe the feature or problem you’d like to solve

It would be great if there was a way to streamline the renewal of an expired github authentication token.

Currently:

$ gh auth status
github.com
  X Failed to log in to github.com account jonathan-enf (/home/jonathan/.config/gh/hosts.yml)
  - Active account: true
  - The token in /home/jonathan/.config/gh/hosts.yml is invalid.
  - To re-authenticate, run: gh auth login -h github.com
  - To forget about this account, run: gh auth logout -h github.com -u jonathan-enf
$ gh auth login -h github.com -p ssh
? Upload your SSH public key to your GitHub account? /home/jonathan/.ssh/id_ed25519.pub
? Title for your SSH key: GitHub CLI
? How would you like to authenticate GitHub CLI? Paste an authentication token
Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
The minimum required scopes are 'repo', 'read:org', 'admin:public_key'.
? Paste your authentication token:

The problem here is that the message reads To re-authenticate, run: gh auth login -h github.com makes the user go through the whole token creation process a second time, including specifying scopes (which the user can get wrong). It would be better if the re-authentication instruction provided a shortcut to creating a new token with the same scopes as the expired token.

Proposed solution

Provide an interface to create a new token based on the expired token, so that the scopes don't have to be filled out again. This could be accomplished by adding a "renew" button next to the "delete" button in the web ui (https://github.com/settings/tokens), and by having gh auth login -h github.com create a link that navigates to the "renew" interface instead of the "create new token" interface.

Alternately, this problem could be resolved using a CLI-only change by letting the user specify all scopes in the gh auth login command, and extra points for having gh auth status provide the user with a command to run that already populates the scopes arguments.

Additional context

n/a.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions