Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficult to log in with a GitHub token #708

Closed
nylen opened this issue Feb 19, 2020 · 4 comments
Closed

Difficult to log in with a GitHub token #708

nylen opened this issue Feb 19, 2020 · 4 comments

Comments

@nylen
Copy link
Contributor

nylen commented Feb 19, 2020

First try:

$ travis login --pro --github-token=...
not logged in - try running travis login --pro

I eventually found the --debug option which told me this might be a permissions issue:

$ travis login --pro --debug --github-token=...
** Loading "/home/username/.travis/config.yml"
** Timeout::Error: execution expired
** Loading gh
** GET "config"
**   took 0.54 seconds
** GitHub API: GET /user?per_page=100
**   took 0.5 seconds
** POST "auth/github" {:github_token=>"..."}
**   took 0.25 seconds
** GET "https://travis-ci.com/insufficient_oauth_permissions#existing-user"
**   took 0.52 seconds
** GET "users/"
**   took 0.11 seconds
not logged in - try running travis login --pro

I then found https://docs.travis-ci.com/user/github-oauth-scopes#travis-ci-for-open-source-projects which is incorrect for this case (using a token with the required permissions granted does not work, yields the same error). This may be because my projects are on travis-ci.com, but that documentation mentions travis-ci.org.

Finally, using a GitHub token with all scopes enabled works, but this shouldn't be necessary!

Please improve these error messages and document what scopes/permissions are actually needed to make the travis CLI tool work...

@BanzaiMan
Copy link
Contributor

Indeed, the message needs to be improved.

The scopes for --com whether or not the repo is private is explained in https://docs.travis-ci.com/user/github-oauth-scopes/#travis-ci-for-private-projects. The wording around here should be clarified.

@BanzaiMan
Copy link
Contributor

With 973dc28 the command now yields:

$ bin/travis login --github-token XXXXXXX
token is invalid, or does not have sufficient scope; see https://docs.travis-ci.com/user/github-oauth-scopes/ for more information on scope

@BanzaiMan
Copy link
Contributor

Try it with gem install travis --pre.

@rodislav
Copy link

if ever someone else stumbles on this part, the needed scopes are: read:org, repo, user:email, write:repo_hook, more on that here : https://docs.travis-ci.com/user/github-oauth-scopes/#travis-ci-for-private-projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants