cli: Can't validate token

Describe the bug

I’m trying to authenticate using the gh auth login command but I get the error could not validate token: missing required scope 'repo';missing required scope 'read:org'.

I’ve already created several tokens, I even gave full permissions to one of the token to make sure it wasn’t the problem. Regardless, I always get the same error.

Steps to reproduce the behavior

  1. Enter the command:
gh auth login --hostname company.hostname --with-token < gh_token.txt
  1. Get the error:
could not validate token: missing required scope 'repo';missing required scope 'read:org'

Expected vs actual behavior

The expected result is that I’m able to authenticate but I always get the same error message. I’ve also tried to use the browser, but then I get a different error:

gh auth login --hostname company.hostname --web                                                                                                                                               
- Logging into company.hostname

failed to authenticate via web browser: could not parse interval="" as integer: strconv.Atoi: parsing "": invalid syntax

Any help is welcome.

Version

gh --version

gh version 1.0.0 (2020-09-16)
https://github.com/cli/cli/releases/tag/v1.0.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (6 by maintainers)

Most upvoted comments

What does adding admin:org look like? Do you paste the token and literally type admin:org and nothing else ~ ie: mytokentextadmin:org? or are there delimiters I’m assumed to know like maybe mytokentext@admin:org ?

No no. You should make it when you generate Personal Access Token on your git account. And it should look like this. Screenshot from 2022-06-06 08-38-14

Adding admin:org worked for me. hope this could help you guys