# tornado.httpclient.HTTPError: HTTP 401: Unauthorized

**URL:** <https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400>\
**Category:** BinderHub\
**Created:** [February 15, 2019, 2:43am UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400 "2019-02-15T02:43:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharypovandrey](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sharypovandrey/32/651_2.png) [@sharypovandrey](https://discourse.jupyter.org/u/sharypovandrey)\
**Post date:** [February 15, 2019, 2:43am UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/1 "2019-02-15T02:43:42Z")

</div>

Hi guys, I launched binder on Google Cloud, I see binder page, but when I try to add repository - Im getting Internal Server Error.  
I checked the logs and found this one

```auto
[I 190208 08:39:41 repoproviders:441] Using cached ref for https://api.github.com/repos/minrk/ligo-binder/commits/master: b8259dac9eb4aa5f2d65d8881f2da94a4952a195
[E 190208 08:39:41 web:1621] Uncaught exception GET /build/gh/minrk/ligo-binder/master (234.234.23.23)
    HTTPServerRequest(protocol='http', host='binder.givemefive.in', method='GET', uri='/build/gh/minrk/ligo-binder/master', version='HTTP/1.1', remote_ip='234.234.23.23')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
        result = yield result
      File "/usr/local/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
        value = future.result()
      File "/usr/local/lib/python3.6/site-packages/binderhub/builder.py", line 273, in get
        image_manifest = await self.registry.get_image_manifest(*'/'.join(image_name.split('/')[-2:]).split(':', 1))
      File "/usr/local/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
        yielded = self.gen.throw(*exc_info)
      File "/usr/local/lib/python3.6/site-packages/binderhub/registry.py", line 199, in get_image_manifest
        auth_resp = yield client.fetch(auth_req)
      File "/usr/local/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
        value = future.result()
    tornado.httpclient.HTTPError: HTTP 401: Unauthorized

```

I got stuck.  
I will appreciate any help!

---

<div class="post-metadata">

**Author:** ![choldgraf](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/choldgraf/32/1264_2.png) [@choldgraf](https://discourse.jupyter.org/u/choldgraf)\
**Post date:** [February 15, 2019, 5:54am UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/2 "2019-02-15T05:54:06Z")

</div>

hey - could you post a link (or copy/paste the text of) your `config.yml` and `secret.yml` file? (make sure to redact the sensitive info). Usually errors and such are a result of something in one of those files!

---

<div class="post-metadata">

**Author:** ![sharypovandrey](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sharypovandrey/32/651_2.png) [@sharypovandrey](https://discourse.jupyter.org/u/sharypovandrey)\
**Post date:** [February 15, 2019, 6:25am UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/3 "2019-02-15T06:25:18Z")

</div>

config.yaml

```auto
config:
  BinderHub:
    use_registry: true
    image_prefix: gcr.io/binder-mybinder5/binder-prod-
config:
  BinderHub:
    hub_url: http://external_ip_that_I_got_from_get_svc_proxy-public_command

```

secret.yaml

```auto
jupyterhub:
  hub:
    services:
      binder:
        apiToken: xxxxxxx
  proxy:
    secretToken: xxxxxxx

registry:
  url: https://gcr.io
  password: |
    {
      "type": "service_account",
      "project_id": "xxxxx",
      "private_key_id": "xxxxxx",
      "private_key": "xxxxxx"
      "client_email": "xxxxx@xxxxxx",
      "client_id": "xxxxxxx",
      "auth_uri": "https://accounts.google.com/o/oauth2/auth",
      "token_uri": "https://oauth2.googleapis.com/token",
      "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
      "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xxxxx
    }

config:
  GitHubRepoProvider:
    access_token: my_github_token

```

---

<div class="post-metadata">

**Author:** ![sharypovandrey](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sharypovandrey/32/651_2.png) [@sharypovandrey](https://discourse.jupyter.org/u/sharypovandrey)\
**Post date:** [February 15, 2019, 8:20am UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/4 "2019-02-15T08:20:14Z")

</div>

I tried Docker also, but had the same error

---

<div class="post-metadata">

**Author:** ![chanderkantsinghal](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/chanderkantsinghal/32/650_2.png) [@chanderkantsinghal](https://discourse.jupyter.org/u/chanderkantsinghal)\
**Post date:** [May 19, 2019, 12:34pm UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/5 "2019-05-19T12:34:11Z")

</div>

@sharypovandrey Recently I am also facing the same problem which you are facing.  
Please tell me how did you solve this. It will be much appreciated.

---

<div class="post-metadata">

**Author:** ![sharypovandrey](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sharypovandrey/32/651_2.png) [@sharypovandrey](https://discourse.jupyter.org/u/sharypovandrey)\
**Post date:** [May 19, 2019, 1:16pm UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/6 "2019-05-19T13:16:35Z")

</div>

Hey! I dont remember certain steps but what helped me is CORS settings.  
Please try to add

```auto
cors: &cors
  allowOrigin: '*'

```

to `secret.yaml`

and then `helm upgrade binder jupyterhub/binderhub --version=0.2.0-6bfd93b -f secret.yaml -f config.yaml`

but it beware its not secure way

---

<div class="post-metadata">

**Author:** ![sharypovandrey](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sharypovandrey/32/651_2.png) [@sharypovandrey](https://discourse.jupyter.org/u/sharypovandrey)\
**Post date:** [May 19, 2019, 1:58pm UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/7 "2019-05-19T13:58:17Z")

</div>

and also check that you have set IP addresses correct

---

<div class="post-metadata">

**Author:** ![chanderkantsinghal](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/chanderkantsinghal/32/650_2.png) [@chanderkantsinghal](https://discourse.jupyter.org/u/chanderkantsinghal)\
**Post date:** [May 24, 2019, 7:01pm UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/8 "2019-05-24T19:01:50Z")

</div>

@sharypovandrey Thanks for reply!

Can you explain you are talking about which IP Addresses?  
Also at which level I have to add cors in secret.yaml. Is it at root level?

---

<div class="post-metadata">

**Author:** ![ajay\_kumar](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/ajay_kumar/32/687_2.png) [@ajay\_kumar](https://discourse.jupyter.org/u/ajay_kumar)\
**Post date:** [May 25, 2019, 1:58am UTC](https://discourse.jupyter.org/t/tornado-httpclient-httperror-http-401-unauthorized/400/9 "2019-05-25T01:58:34Z")

</div>

@choldgraf I’m also facing the same issue from a log time. I’m using DockerHub with DigitalOcean

Here is my secret.yaml

```auto
cors: &cors
  allowOrigin: '*'
jupyterhub:
  hub:
    extraConfigMap:
      cors: *cors
    services:
      binder:
        apiToken: XXXXXXXX
  proxy:
    secretToken: XXXXXXXX
registry:
  username: hmharshit
  password: XXXXXXXX

```

It would be much appreciated if you can share your secret.yaml and config.yaml which are working after rectifying 401 issue.
