# Generic OAuthenticator redirect issue

**URL:** <https://discourse.jupyter.org/t/generic-oauthenticator-redirect-issue/4078>\
**Category:** JupyterHub\
**Tags:** community, how-to, help-wanted\
**Created:** [April 21, 2020, 11:48am UTC](https://discourse.jupyter.org/t/generic-oauthenticator-redirect-issue/4078 "2020-04-21T11:48:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saurav\_Bhagat](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/saurav_bhagat/32/1551_2.png) [@Saurav\_Bhagat](https://discourse.jupyter.org/u/Saurav_Bhagat)\
**Post date:** [April 21, 2020, 11:48am UTC](https://discourse.jupyter.org/t/generic-oauthenticator-redirect-issue/4078/1 "2020-04-21T11:48:43Z")

</div>

I’m using generic oauthenticator to setup on-premise oauth2 service. This is the configuration I have done.

In the configmap file:  
\> auth:

> ```
> type: custom
> custom:
> className: oauthenticator.generic.GenericOAuthenticator
> config:
> login_service: "myservice"
> client_id: "client-id" 
> client_secret: "string"
> token_url: https://my-company.com/adfs/oauth2/token/
> userdata_url: https://my-company.com/adfs/userinfo
> userdata_method: GET
> userdata_params: {'state': 'state'}
> username_key: Name
> hub:
> extraEnv:
> OAUTH2_AUTHORIZE_URL: https://my-company.com/adfs/oauth2/authorize/
> OAUTH2_TOKEN_URL: https://my-company.com/adfs/oauth2/token/
> OAUTH_CALLBACK_URL: https://my-notebook.com/hub/oauth_callback
> 
> ```

And this is my logs, It is redirecting to same url again and again.

> [I 2020-04-21 11:31:36.319 JupyterHub log:158] 302 GET / → /hub (@127.0.0.1) 0.86ms  
> [I 2020-04-21 11:31:36.603 JupyterHub log:158] 302 GET /hub → /hub/ (@127.0.0.1) 0.51ms  
> [I 2020-04-21 11:31:36.885 JupyterHub log:158] 302 GET /hub/ → /hub/login (@127.0.0.1) 0.80ms  
> [D 2020-04-21 11:31:37.170 JupyterHub log:158] 304 GET /hub/login (@127.0.0.1) 1.28ms  
> [D 2020-04-21 11:31:37.721 JupyterHub log:158] 200 GET /hub/static/css/style.min.css.map (@127.0.0.1) 1.44ms  
> [I 2020-04-21 11:31:40.983 JupyterHub oauth2:82] OAuth redirect: ‘[https://my-notebook.com/hub/oauth\_callback](https://my-notebook.com/hub/oauth_callback)’  
> [I 2020-04-21 11:31:40.984 JupyterHub log:158] 302 GET /hub/oauth\_login?next= → ?response\_type=code&redirect\_uri=https%3A%2F%[2Fmy-notebook.com](http://2Fmy-notebook.com)%2Fhub%2Foauth\_callback&client\_id=client-id&state=[secret] (@127.0.0.1) 1.31ms  
> [I 2020-04-21 11:31:41.268 JupyterHub oauth2:82] OAuth redirect: ‘[https://my-notebook.com/hub/oauth\_callback](https://my-notebook.com/hub/oauth_callback)’  
> [I 2020-04-21 11:31:41.269 JupyterHub log:158] 302 GET /hub/oauth\_login?response\_type=code&redirect\_uri=https%3A%2F%[2Fmy-notebook.com](http://2Fmy-notebook.com)%2Fhub%2Foauth\_callback&client\_id=client-id&state=[secret] → ?response\_type=code&redirect\_uri=https%3A%2F%[2my-notebook.com](http://2my-notebook.com)%2Fhub%2Foauth\_callback&client\_id=client-id&state=[secret] (@127.0.0.1) 1.03ms  
> [I 2020-04-21 11:31:41.551 JupyterHub oauth2:82] OAuth redirect: ‘[https://my-notebook.com/hub/oauth\_callback](https://my-notebook.com/hub/oauth_callback)’  
> [I 2020-04-21 11:31:41.552 JupyterHub log:158] 302 GET /hub/oauth\_login?response\_type=code&redirect\_uri=https%3A%2F%[2Fnotebook.com](http://2Fnotebook.com)%2Fhub%2Foauth\_callback&client\_id=client-id&state=[secret] → ?response\_type=code&redirect\_uri=https%3A%2F%[2Fmy-notebook.com](http://2Fmy-notebook.com)%2Fhub%2Foauth\_callback&client\_id=client-id&state=[secret] (@127.0.0.1) 1.46ms  
> [I 2020-04-21 11:31:41.833 JupyterHub oauth2:82] OAuth redirect: ‘[https://my-notebook.com/hub/oauth\_callback](https://my-notebook.com/hub/oauth_callback)’  
> [I 2020-04-21 11:31:41.834 JupyterHub log:158] 302 GET /hub/oauth\_login?response\_type=code&redirect\_uri=https%3A%2F%[2Fmy-notebook.com](http://2Fmy-notebook.com)%2Fhub%2Foauth\_callback&client\_id=client-id&state=[secret] → ?response\_type=code&redirect\_uri=https%3A%2F%[2Fnotebook.com](http://2Fnotebook.com)%2Fhub%2Foauth\_callback&client\_id=client-id=&state=[secret] (@127.0.0.1) 0.94ms  
> [I 2020-04-21 11:31:42.115 JupyterHub oauth2:82] OAuth redirect: ‘[https://my-notebook.com/hub/oauth\_callback](https://my-notebook.com/hub/oauth_callback)’

What is the issue?  
Thanks

---

<div class="post-metadata">

**Author:** ![csadorf](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/csadorf/32/6320_2.png) [@csadorf](https://discourse.jupyter.org/u/csadorf)\
**Post date:** [June 3, 2020, 2:22pm UTC](https://discourse.jupyter.org/t/generic-oauthenticator-redirect-issue/4078/2 "2020-06-03T14:22:32Z")

</div>

I’m experiencing the same issue with helm chart version 0.9.0 (JupyterHub 1.1). Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Payam\_Chychi](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/payam_chychi/32/2445_2.png) [@Payam\_Chychi](https://discourse.jupyter.org/u/Payam_Chychi)\
**Post date:** [July 23, 2020, 4:05am UTC](https://discourse.jupyter.org/t/generic-oauthenticator-redirect-issue/4078/3 "2020-07-23T04:05:08Z")

</div>

I’m curious if you figured out a solution? Thanks

---

<div class="post-metadata">

**Author:** ![Saurav\_Bhagat](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/saurav_bhagat/32/1551_2.png) [@Saurav\_Bhagat](https://discourse.jupyter.org/u/Saurav_Bhagat)\
**Post date:** [July 23, 2020, 6:29am UTC](https://discourse.jupyter.org/t/generic-oauthenticator-redirect-issue/4078/4 "2020-07-23T06:29:06Z")

</div>

Unfortunately, No. My applicaition is still stuck with dummy authenticator.

---

<div class="post-metadata">

**Author:** ![Jeff\_Thomassen](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jeff_thomassen/32/2453_2.png) [@Jeff\_Thomassen](https://discourse.jupyter.org/u/Jeff_Thomassen)\
**Post date:** [July 24, 2020, 6:12pm UTC](https://discourse.jupyter.org/t/generic-oauthenticator-redirect-issue/4078/5 "2020-07-24T18:12:45Z")

</div>

Did you try exporting these environment variables:  
OAUTH2\_TOKEN\_URL # the same as token\_url param  
OAUTH2\_AUTHORIZE\_URL # oauth2 provider’s authorization endpoint

[https://github.com/jupyterhub/oauthenticator/issues/107](https://github.com/jupyterhub/oauthenticator/issues/107)
