# Configuring Zero To Jupyter Hub to use an arbitrary OAuth2 provider

**URL:** <https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542>\
**Category:** Zero to JupyterHub on Kubernetes\
**Tags:** jupyterhub, how-to\
**Created:** [August 8, 2020, 12:09am UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542 "2020-08-08T00:09:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/rick/32/2541_2.png) [@rick](https://discourse.jupyter.org/u/rick)\
**Post date:** [August 8, 2020, 12:09am UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/1 "2020-08-08T00:09:09Z")

</div>

Has anyone had experience configuring Zero To Jupyter Hub so the resulting Hub uses an OAuth2 provider other than Google, Github, Azure, CILogon, or Globus? Should we be using OpenID Connect?

Started with this doc…[https://zero-to-jupyterhub.readthedocs.io/en/0.9.1/administrator/authentication.html](https://zero-to-jupyterhub.readthedocs.io/en/0.9.1/administrator/authentication.html)

Thanks  
Rick

---

<div class="post-metadata">

**Author:** ![fbalicchia](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fbalicchia/32/2433_2.png) [@fbalicchia](https://discourse.jupyter.org/u/fbalicchia)\
**Post date:** [August 10, 2020, 5:38am UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/2 "2020-08-10T05:38:03Z")

</div>

Hi Rick,  
yes we are using Z2JH with keycloak.

---

<div class="post-metadata">

**Author:** ![rick](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/rick/32/2541_2.png) [@rick](https://discourse.jupyter.org/u/rick)\
**Post date:** [August 10, 2020, 1:04pm UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/3 "2020-08-10T13:04:35Z")

</div>

Filippo,  
I’d like to do a short dive with you to understand the adjustments to the helm charts and config file. Is there a good time/way to get in touch, or would you prefer it on this thread?

– Rick

---

<div class="post-metadata">

**Author:** ![fbalicchia](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fbalicchia/32/2433_2.png) [@fbalicchia](https://discourse.jupyter.org/u/fbalicchia)\
**Post date:** [August 10, 2020, 2:23pm UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/4 "2020-08-10T14:23:40Z")

</div>

Hi Rick,  
I’m back to work tomorrow. If is for you we can use this thread in this manner we can use the outcome to enrich documentation.  
That say the first thing to change in values.yaml is

```auto
auth:
  type: custom
  state:
    enabled: true
    cryptoKey: "b3191fifgjgjge4d82817f6052423285c93db2e86878e352a4808d66cf318d1"
  custom:
    className: oauthenticator.generic.GenericOAuthenticator
    config:
      login_service: "my_service"
      client_id: "client_id"
      client_secret: "client_secret"
      token_url: http://keycloak-default.192.168.64.100.nip.io/auth/realms/che/protocol/openid-connect/token
      userdata_url: http://keycloak-default.192.168.64.100.nip.io/auth/realms/che/protocol/openid-connect/userinfo
      userdata_method: GET
      userdata_params: {'state': 'state'}

```

```auto
 extraEnv:
    OAUTH2_AUTHORIZE_URL: http://keycloak-default.192.168.64.100.nip.io/auth/realms/che/protocol/openid-connect/auth
    OAUTH2_TOKEN_URL: http://keycloak-default.192.168.64.100.nip.io/auth/realms/che/protocol/openid-connect/token
    OAUTH_CALLBACK_URL: http://jhub-default.192.168.64.100.nip.io/hub/oauth_callback

```

the you need to configure kc side

---

<div class="post-metadata">

**Author:** ![rick](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/rick/32/2541_2.png) [@rick](https://discourse.jupyter.org/u/rick)\
**Post date:** [August 10, 2020, 2:53pm UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/5 "2020-08-10T14:53:25Z")

</div>

It’s perfect, thanks, and let’s update the authorization page with this…

Thanks  
Rick

---

<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:** [August 10, 2020, 3:10pm UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/6 "2020-08-10T15:10:44Z")

</div>

it would be great to see improvements to the documentation to make sure this use-case is covered 👍

---

<div class="post-metadata">

**Author:** ![jgato](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jgato/32/2785_2.png) [@jgato](https://discourse.jupyter.org/u/jgato)\
**Post date:** [May 11, 2021, 4:06pm UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/7 "2021-05-11T16:06:51Z")

</div>

thanks @fbalicchia it worked ok. But I cannot logout, any hint about it?

by the way, I had to add the username\_key: email

---

<div class="post-metadata">

**Author:** ![umajuphub](https://avatars.discourse-cdn.com/v4/letter/u/50afbb/32.png) [@umajuphub](https://discourse.jupyter.org/u/umajuphub)\
**Post date:** [October 10, 2023, 3:08pm UTC](https://discourse.jupyter.org/t/configuring-zero-to-jupyter-hub-to-use-an-arbitrary-oauth2-provider/5542/8 "2023-10-10T15:08:36Z")

</div>

Do we need to make changes to jupyterhub\_config.py also ? We are using help chart to setup Jupytehub on kubernetes .Any link with all the changes required in values.yaml and also in jupyterhub\_config.yaml
