Skip to content

Revoke all scopes on gh auth refresh without --scope #6785

@scarf005

Description

@scarf005

Describe the feature or problem you’d like to solve

HTTP 403: Must have admin rights to Repository. (https://api.github.com/repos/scarf005/pyvips)
This API operation needs the "delete_repo" scope. To request it, run:  gh auth refresh -h github.com -s delete_repo

after repo deletion, I wanted to revoke delete_repo scope given with gh auth refresh, since I did not want to accidently delete repos.

The --scopes flag accepts a comma separated list of scopes you want your gh credentials to have. If absent, this command ensures that gh has access to a minimum set of scopes.

I ran gh auth refresh again as the description in cli doc said.

image

but to my surprise cli still had access to repository deletion. as said in #5083, current way to revoke github cli's scope is to completely de-authorize github cli app. this is very inconvenient.

Proposed solution

gh repo request should follow the documentation and revoke access to the point of minimum set of scopes.
in this example, Delete Repositories access should be revoked.

Discussed in #5083

Originally posted by pritambera2000 January 23, 2022
How to revoke scopes on gh auth refresh . After granting a scope can't revoke it from cli

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