hub-tool icon indicating copy to clipboard operation
hub-tool copied to clipboard

Add scope support to access tokens

Open thinkst-marco opened this issue 4 years ago • 3 comments

- What I did

Add support for token scopes. Access Tokens created in the web interface can take a single scope value but this isn't available in hub-tool. This change lets the user create tokens with a specific scope.

- How I did it

Two user-facing changes:

  1. Added a --scope parameter to token create.
  2. Added a SCOPE column to token ls

- How to verify it

The following calls add tokens with the specified scopes:

$ hub-tool token create --scope public_read --format json | jq -c '.Scopes'
[ "repo:public_read" ]
$ hub-tool token create --scope read --format json | jq -c '.Scopes'
[ "repo:read" ]
$ hub-tool token create --description test-cli-scope-5 --scope write --format json | jq -c '.Scopes'
[ "repo:write" ]
$ hub-tool token create --description test-cli-scope-5 --scope admin --format json | jq -c '.Scopes'
[ "repo:admin" ]

Showing the added column in token ls:

$ hub-tool token ls
DESCRIPTION         UUID                                    LAST USED         CREATED          ACTIVE    SCOPE
[...]

- Description for the changelog

Add scope support to access tokens

- A picture of a cute animal (not mandatory)

thinkst-marco avatar Sep 16 '21 14:09 thinkst-marco

can anyone merge this

zdhamasha avatar Oct 13 '21 08:10 zdhamasha

Is there new update here? Or code review required? regards, Jayesh

jaythamke avatar Nov 03 '21 08:11 jaythamke

Hi @converge, I observed that you mentioned this PR in your fix #203 , but we do not find the mention in your PR. Could you please confirm if the changes in this PR are included in your PR?

jaythamke avatar Oct 17 '22 08:10 jaythamke