question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GenericOAuthenticator doesnt redirect to the Identity server

See original GitHub issue

Hi, I have set up Jupyter Hub on Ubuntu 20.x I have then used tljh-config to set up identity provider as below:

abc@def:~$ sudo tljh-config show
users:
  admin:
  - admin
user_environment:
  default_app: jupyterlab
https:
  enabled: true
  letsencrypt:
    email: ma@def.com
    domains:
    - xx.southeastasia.cloudapp.azure.com
auth:
  GenericOAuthenticator:
    client_id: f120eeee-b3c2-477c-9dd8-725879a5bbd7
    client_secret: xyz
    token_url: https://yy.azurewebsites.net/identity/connect/token
    userdata_url: https://yy.azurewebsites.net/identity/connect/userinfo
    username_key: preferred_username
    login_service: yy
    oauth_callback_url: https://xx.southeastasia.cloudapp.azure.com/hub/oauth_callback
  OAuthenticator:
    client_id: f120eeee-b3c2-477c-9dd8-725879a5bbd7
    client_secret: xyz
  type: oauthenticator.generic.GenericOAuthenticator
os:
  environ[OAUTH2_TOKEN_URL]: https://yy.azurewebsites.net/identity/connect/token
  environ[OAUTH2_USERDATA_URL]: https://yy.azurewebsites.net/identity/connect/userinfo
  environ[OAUTH2_AUTHORIZE_URL]: https://yy.azurewebsites.net/identity/connect/authorize

However, when I try to log in, it gives the following error before even redirecting to my Identity provider:

https://xx.southeastasia.cloudapp.azure.com/hub/oauth_login?response_type=code&redirect_uri=https%3A%2F%xx.southeastasia.cloudapp.azure.com%2Fhub%2Foauth_callback&client_id=f120eeee-b3c2-477c-9dd8-725879a5bbd7&state=eyJzdGF0ZV9pZCI6ICJjYjM5ZjRlNjgzODU0ZDgyOWY0MjVmZDFiN2YwMTBmNyIsICJuZXh0X3VybCI6IG51bGx9 image

Is there something i have done wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
malichishticommented, Sep 2, 2021

@consideRatio I managed to solve this eventualy, whats missing in the docs is that if you are using https://oauthenticator.readthedocs.io/en/latest/getting-started.html#general-setup then JupyterHub will be set up as systemmd service. Now the docs does say to define OAUTH2_TOKEN_URL and OAUTH2_AUTHORIZE_URL environment variables but since this is systemd service it has to be done as below:

sudo systemctl stop jupyterhub.service
sudo systemctl edit jupyterhub.service

Add following:

Environment=OAUTH2_TOKEN_URL=https://xx/identity/connect/token Environment=OAUTH2_AUTHORIZE_URL=https://xx/identity/connect/authorize

sudo systemctl start jupyterhub.service

0reactions
consideRatiocommented, Sep 2, 2021

For any separate thing that should be a github issue, make it a separate github issue.

I don’t know if the GenericOAuthenticator supports a hybrid auth flow. You can indeed open a feature request for that in this github repo. I have a some wishes as a maintainer trying to find time to do whats needed to maintain this and other repos in this github org:

  1. Try to verify it isn’t already a supported feature and reference what makes you think so.
  2. Outline clearly the situations where a hybrid flow makes sense for someone to have.
  3. If you can, also try summarize technically what needs to be done for GenericOAuthenticator to support this.
Read more comments on GitHub >

github_iconTop Results From Across the Web

GenericOAuthenticator doesnt redirect to the Identity server
Hi, I have set up Jupyter Hub on Ubuntu 20.x I have then used tljh-config to set up identity provider as below: abc@def:~$...
Read more >
Getting started - OAuthenticator - Read the Docs
The general steps to take when using OAuthenticator: Register an OAuth2 application with the identity provider. Configure JupyterHub to use an authenticator ...
Read more >
Identity server does not redirect after sucessfull login
I am trying to set up IdentityServer4 with MVC client. Everything works fine until I want to add ASP Identity ...
Read more >
Redirect to MVC client using Google Authenticaiton not working
I am using Identity server 4 for authentication. ... But then identity server does not redirect back to the mvc client.
Read more >
oauthenticator/getting-started.rst at main · jupyterhub/oauthenticator ...
The general steps to take when using OAuthenticator: Register an OAuth2 application with the identity provider; Configure JupyterHub to use an authenticator ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found