Generic OAuthenticator redirect issue

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
[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%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
[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%2Fhub%2Foauth_callback&client_id=client-id&state=[secret] → ?response_type=code&redirect_uri=https%3A%2F%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
[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%2Fhub%2Foauth_callback&client_id=client-id&state=[secret] → ?response_type=code&redirect_uri=https%3A%2F%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
[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%2Fhub%2Foauth_callback&client_id=client-id&state=[secret] → ?response_type=code&redirect_uri=https%3A%2F%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

What is the issue?
Thanks

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

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

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

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