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

Could not authenticate error with Twitter #21

Closed
hamzaelsaawy opened this issue Oct 20, 2018 · 5 comments
Closed

Could not authenticate error with Twitter #21

hamzaelsaawy opened this issue Oct 20, 2018 · 5 comments

Comments

@hamzaelsaawy
Copy link

My code returns a 401 HTTP.ExceptionRequest.StatusError: {"code":32,"message":"Could not authenticate you."}

Running Julia 1.0 with package status [22d8b318] OAuth v0.7.0.
My tokens work using twurl and tweepy, code is:

import OAuth
endpoint = "https://api.twitter.com/1.1/users/show.json"
options = Dict("screen_name" => "twitterdev")

httpmethod = "GET"
oauth_consumer_key = "..."
oauth_consumer_secret = "..."
oauth_token = "..."
oauth_token_secret = "..."

OAuth.oauth_request_resource(endpoint, httpmethod, options, oauth_consumer_key, 
    oauth_consumer_secret, oauth_token, oauth_token_secret)

The response is:

ERROR: HTTP.ExceptionRequest.StatusError(401, HTTP.Messages.Response:
"""
HTTP/1.1 401 Unauthorized
content-length: 64
content-type: application/json; charset=utf-8
date: Sat, 20 Oct 2018 19:38:49 GMT
server: tsa_b
set-cookie: personalization_id="v1_7vUSIDnL5tNr88OLPIlFpw=="; Expires=Mon, 19 Oct 2020 19:38:49 GMT; Path=/; Domain=.twitter.com, guest_id=v1%3A154006432993982064; Expires=Mon, 19 Oct 2020 19:38:49 GMT; Path=/; Domain=.twitter.com
strict-transport-security: max-age=631138519
x-connection-hash: ff8b6f836dd6e46d4eb6c096a372b467
x-response-time: 10

{"errors":[{"code":32,"message":"Could not authenticate you."}]}""")
@randyzwitch
Copy link
Owner

Not sure what to tell you...the original tests of this package still pass on Julia 1.0, but I haven't paid my attention to this package (or the related Twitter.jl) in some time.

But if you're willing to dig into it, please feel free to submit a PR

@hamzaelsaawy
Copy link
Author

Unfortunately the tests dont test the oauth_header and oauth_request_resource functions.
Ill try and dig around, but Im pretty new to web stuff, so no promises :/

@randyzwitch
Copy link
Owner

It's possible that Twitter may have changed its authentication scheme, or it could be in the Julia package. I went back and re-ran the CI here for version 0.4.0 (which passed originally), but now it doesn't

https://travis-ci.org/randyzwitch/Twitter.jl/builds/317061488

I can't work on it right, but probably the best thing to do if you're really interested in solving this would be to work from one of the passing Twitter.jl builds on Travis, pin the packages, then figure out which package breaks Twitter.jl.

@randyzwitch
Copy link
Owner

@hamzaelsaawy I just fixed what should be the answer. If you re-run your code using the master branch, it should work (I just validated your code with my credentials).

If Twitter interests you though, it'd be great to clean up Twitter.jl.

@hamzaelsaawy
Copy link
Author

That works, thanks!
Ill take a look, but no promises

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

2 participants