Skip to content

Updated config is not correctly picked up after re-auth #914

@lumaxis

Description

@lumaxis

Describe the bug

When trying to use gh pr checkout, I was prompted to re-auth to add the read:org scope to the OAuth(?) app's permissions. After successfully completing that flow, the CLI still error'd thinking it's still lacking the required scopes.
A second attempt at the same command worked without any problems

Expected vs actual behavior

  1. Given the CLI OAuth does not have the read:org scope
  2. When using gh pr checkout command to checkout a PR locally
  3. And successfully completing the automatic re-auth flow in the browser to add the missing scope
  4. Then it should correctly continue with the checkout flow

Instead, it failed with an error.

Logs

$ gh pr checkout https://github.com/<org>/<repo>/pull/123
Notice: additional authorization required
Press Enter to open github.com in your browser...
Authentication complete. Press Enter to continue...
graphql error: 'Your token has not been granted the required scopes to execute this query. The 'name' field requires one of the following scopes: ['read:org', 'read:discussion'], but your token has only been granted the: ['repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens.'

$ gh pr checkout https://github.com/<org>/<repo>/pull/123
Switched to a new branch 'feature/add-deploy-readme'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions