# How to authenticate requests with HTTP.jl?

**URL:** <https://discourse.julialang.org/t/how-to-authenticate-requests-with-http-jl/3678>\
**Category:** Web Stack\
**Tags:** question, web\
**Created:** [May 12, 2017, 6:13pm UTC](https://discourse.julialang.org/t/how-to-authenticate-requests-with-http-jl/3678 "2017-05-12T18:13:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [May 12, 2017, 6:13pm UTC](https://discourse.julialang.org/t/how-to-authenticate-requests-with-http-jl/3678/1 "2017-05-12T18:13:54Z")

</div>

Suppose we want to get information from GitHub API for various users:

```julia
using HTTP
for user in users
  resp = HTTP.get("https://api.github.com/users/$user")
end

```

The code fails for a large number of users due to the reduced rate limits for unauthenticated requests. Can you please explain how one can authenticate these requests with HTTP.jl? I have my GitHub authentication token set and working with GitHub.jl.

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [May 12, 2017, 9:11pm UTC](https://discourse.julialang.org/t/how-to-authenticate-requests-with-http-jl/3678/2 "2017-05-12T21:11:39Z")

</div>

GitHub can authenticate you using a [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/). Once you generate the token, you can just add `?access_token=<YOUR_TOKEN>` to the end of the URL and it should work. At least this is what [worked for me](https://github.com/dfdx/PackageTracker.jl/blob/master/src/gh.jl#L20-L26) in PackageTracker.jl.

---

<div class="post-metadata">

**Author:** ![essenciary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/essenciary/32/210469_2.png) [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Post date:** [July 1, 2017, 6:54am UTC](https://discourse.julialang.org/t/how-to-authenticate-requests-with-http-jl/3678/3 "2017-07-01T06:54:09Z")

</div>

I’ve done something similar in a project - you’re better off interacting with GitHub through GitHub.jl  
[https://github.com/JuliaWeb/GitHub.jl](https://github.com/JuliaWeb/GitHub.jl)

It takes a config where you pass your token and it handles authentication for you.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [July 2, 2017, 5:01am UTC](https://discourse.julialang.org/t/how-to-authenticate-requests-with-http-jl/3678/4 "2017-07-02T05:01:28Z")

</div>

@essenciary, I used GitHub.jl at the time I asked the question:

The notebook is part of our JuliaGraphTutorials repository: [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/github/JuliaGraphs/JuliaGraphsTutorials/blob/master/DAG-Julia-Pkgs.ipynb)

---

<div class="post-metadata">

**Author:** ![ZacLN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zacln/32/2748_2.png) [@ZacLN](https://discourse.julialang.org/u/ZacLN)\
**Post date:** [August 1, 2018, 7:37pm UTC](https://discourse.julialang.org/t/how-to-authenticate-requests-with-http-jl/3678/5 "2018-08-01T19:37:34Z")

</div>

Returning to the original post, how would one do this in general? Specifically I’m trying to connect to Companies House ([https://developer.companieshouse.gov.uk/api/docs/index/gettingStarted/apikey\_authorisation.html](https://developer.companieshouse.gov.uk/api/docs/index/gettingStarted/apikey_authorisation.html)) and prepending my key and flagging `basic_authorization` doesn’t work
