Skip to content

Show token scopes in gh auth status #6520

Closed

Description

@mntlty

Describe the feature or problem you’d like to solve

the current output of running gh auth status is

github.com
  ✓ Logged in to github.com as mntlty (oauth_token)
  ✓ Git operations for github.com configured to use ssh protocol.
  ✓ Token: *******************

it would be helpful to list the scopes the token has access to

Proposed solution

Running this command generates an api call to the graphql endpoint to query the current user. The oauth scopes are available as part of the x-oauth-scopes headers in the response.

Additional context

it is possible to add scopes to a token with gh auth login --scopes <scope-names> but as far as I can tell there's no way to view the scopes of a token from a cli command

Activity

  1. added and removed on Oct 31, 2022
  2. mislav commented on Oct 31, 2022

    @mislav
    Contributor

    Good idea; thanks!

    Note that if the token is a token of a different kind than PAT v1 or OAuth app token, scopes header will be empty. I wonder what we should print in that case.

  3. mntlty commented on Oct 31, 2022

    @mntlty
    ContributorAuthor

    that's a good question. we could not print anything like we do today, or print that scopes aren't available based on the token type (is there a way to tell the token type?) which tells the user that we tried and it's not broken.

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 CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions