travis.rb: Always getting "invalid access token"
If you are experiencing this issue to, use the reaction button to +1 this post.
$ ruby --version
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
$ travis --version
1.8.0
$ rm -Rf ~/.travis
$ travis login --debug --github-token $GITHUB_TRAVIS_TOKEN
** Loading gh
** GET "config"
** took 0.28 seconds
** GitHub API: GET /user?per_page=100
** took 1.7 seconds
** POST "auth/github" {:github_token=>"6f73bc1b55588f461137b18a5e1d1c9589e3b943"}
** took 0.51 seconds
** GET "users/"
** took 0.39 seconds
Successfully logged in as balupton!
** Storing "/Users/balupton/.travis/config.yml"
$ travis restart -r docpad/website --debug
** Loading "/Users/balupton/.travis/config.yml"
** Loading gh
** GET "config"
** took 0.3 seconds
** GitHub API: HEAD /repos/docpad/website
** took 2.2 seconds
** GET "repos/docpad/website"
** took 0.86 seconds
invalid access token - try running travis login --org
$ travis logout
Successfully logged out!
$ rm -Rf ~/.travis
$ travis login --debug --auto-password
** Loading gh
** GET "config"
** took 0.33 seconds
** Tools::Github: requesting to load github.com login and password from keychain
** GitHub API: POST /authorizations
** GitHub API: GET /user?per_page=100
** Tools::Github: token is not acceptable: Requires authentication
We need your GitHub login to identify you.
This information will not be sent to Travis CI, only to api.github.com.
The password will not be displayed.
Try running with --github-token or --auto if you don't want to enter your password anyway.
Username: balupton
Password for balupton: BLAH
** GitHub API: POST /authorizations
Two-factor authentication code for balupton: BLAH
** GitHub API: POST /authorizations
** took 1.3 seconds
** GitHub API: GET /user?per_page=100
** took 1.4 seconds
** POST "auth/github" {:github_token=>"BLAH"}
** took 0.62 seconds
** GET "users/"
** took 0.41 seconds
Successfully logged in as balupton!
** GitHub API: DELETE /authorizations/BLAH
** took 1.5 seconds
** Storing "/Users/balupton/.travis/config.yml"
$ travis restart -r docpad/website --debug
** Loading "/Users/balupton/.travis/config.yml"
** Timeout::Error: execution expired
** Loading gh
** GET "config"
** took 0.29 seconds
** GitHub API: HEAD /repos/docpad/website
** took 1.6 seconds
** GET "repos/docpad/website"
** took 0.35 seconds
invalid access token - try running travis login --org
$ travis logout
Successfully logged out!
$ rm -Rf ~/.travis
$ travis login --auto --org --debug
** Loading gh
** GET "config"
** took 0.36 seconds
** Tools::Github: requesting to load GitHub for Mac token from keychain
** GitHub API: GET /user?per_page=100
** took 1.7 seconds
** POST "auth/github" {:github_token=>"BLAH"}
** took 0.52 seconds
** GET "users/"
** took 0.34 seconds
Successfully logged in as balupton!
** Storing "/Users/balupton/.travis/config.yml"
$ travis restart -r docpad/website --debug
** Loading "/Users/balupton/.travis/config.yml"
** Loading gh
** GET "config"
** took 0.64 seconds
** GitHub API: HEAD /repos/docpad/website
** took 2 seconds
** GET "repos/docpad/website"
** took 0.27 seconds
invalid access token - try running travis login --org
About this issue
- Original URL
- State: open
- Created 9 years ago
- Reactions: 88
- Comments: 77 (8 by maintainers)
Any update on this? This is a pretty important thing to not be working.
Thanks in advance!
Ian
Assuming previous discussion is on-point, it seems like the issue is getting erroneously labelled as malicious by some blacklisting bot. Is there a process for recovering an IP address from this black hole? I was hit by it a few days ago and, despite not touching
https://api.travis-ci.org/for a couple of days, I’m still blocked.Also, if it would be possible to return a different error code for blocked IPs, and produce a more obvious error message in
session.rb, that would be awesome. It’s not a perfect match, but 503 Service Unavailable is pretty close, since you’re doing this in response to a DDOS attack. You could even send an enormousRetry-Afterto indicate retrying won’t help.@eranshapira sounds like your company should pay @rkh to fix it, rather than to pay your devs to migrate
Support solved my problem! First, mine was a little different than the OPs problem. I was following these instructions: https://docs.travis-ci.com/user/triggering-builds and using a
proaccount. It turns out the API URL is different forproaccounts than the URL in the instructions. You should useapi.travis-ci.cominstead ofapi.travis-ci.org. The support person said she made a PR to the instructions so they may already be updated. HTH@bhansa Try with
--debug --debug-httpflags to show how the command is hanging. For a successful login, it looks like this:You might also want to try
--github-token, with which the output looks like:How is this issue still open after 1.5 years? I’m having the same issue. I can’t get an org token that will work
I had this problem in the office today as well and could not find the cause. It seems some backend servers respond with
403on the firstHEAD /request, which is performed to test the SSL connection. I “fixed” it by monkey-patching thedef check_sslmethod insession.rbto do nothing.I want to remark that the client works fine without the patch from my home internet connection. Maybe a different travis endpoint is used?
(https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) to +1 this post.
This worked for me
Was getting the described behavior until I explicitly put --org, token and repo options. Then it worked. Maybe the “auto discovery” doesn’t work. Tried it when I noticed using the --debug-http option that even though I logged in with “–org” the encrypt command was trying to connect to travis-ci.com.
@Thor07, do you know if there is any way to determine this? I might have putzed around with the
curlconfigurations, but I do not know for sure…I do not think that I have done anything to affect the browser.@arewm @graingert are you by chance using a request modifier extension under hood like modheader(if using a browser) which causes this issue too.
There has not been any motion on this in over a year. I am still getting the same error and the suggested workaround is not working (commenting out
check_ssl).Are there any other ideas on the matter, or have others gotten this working?
I signed up for a plan yesterday and ran into this today. I’ve contacted them and we’ll see if I continue paying… Gitlab has been making a lot of interesting noise lately.
On Wed, Jan 18, 2017 at 7:34 PM, Thomas Grainger notifications@github.com wrote:
This is beyond embarrassing for Travis.
It’s not the client since I’m only trying to trigger a build using Travis API as per https://docs.travis-ci.com/user/triggering-builds. I tried one request with a wrong token by mistake and now constantly getting “access denied” from Travis. I guess I’ll be shopping elsewhere very soon.
i just started getting this this morning 😕
I think this is our (quite aggressive) auto-blocking kicking in, which we have in place due to a permanent DDoS we’ve been under since September. I think the “invalid access token” is a red herring that’s automatically generated by the client on 403s.
I’ll see if I can figure out a way to solve this without opening the floodgates.
I’ve installed/uninstalled travis and tried several things but I’m always getting invalid access token…
Getting this too.
ARGH!!!
So it seems if you want it to work every time, then you must include
--organd-tproperties.This is the most annoying bug ever.
So I came up with this, which still failed:
Then I did this, which worked:
Then I did this, which still worked:
It seems that the subsequent commands have an issue with using a consistent endpoint. I would imagine that by default, the endpoint for commands should be the first one in
~/.travis/config.yml