Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Authentication Redirects to 404 Page not found #193

Closed
Akmoore7 opened this issue Jun 7, 2018 · 10 comments
Closed

Github Authentication Redirects to 404 Page not found #193

Akmoore7 opened this issue Jun 7, 2018 · 10 comments

Comments

@Akmoore7
Copy link

Akmoore7 commented Jun 7, 2018

Currently jupyterhub is running when logging in using PAM, but we are trying to configure github authentication. When running "Sign in with Github" shows up but when clicked it takes the user to "https://github.com/login/oauth/authorize?redirect_uri=https%3A%2F%2Fjupyter2.uiuc-bdeep.org%2Fhub%2Foauth_callback&client_id=&response_type=code&state=eyJuZXh0X3VybCI6ICIiLCAic3RhdGVfaWQiOiAiZTdjNGU1YTkzZGU0NDViMGE4ZWU0NzY3ODY1Y2I1YmUifQ%3D%3D"

This is our config file:

Configuration file for jupyterhub

c.JupyterHub.ssl_key = '/etc/letsencrypt/live/jupyter2.uiuc-bdeep.org/privkey.pem'
c.JupyterHub.ssl_cert = '/etc/letsencrypt/live/jupyter2.uiuc-bdeep.org/fullchain.pem'
c.JupyterHub.port = 443

c.Spawner.notebook_dir = '~/assignments'

from oauthenticator.github import GitHubOAuthenticator
c.JupyterHub.authenticator_class = GitHubOAuthenticator
c.MyOAuthenticator.oauth_callback_url = 'https://jupyter2.uiuc-bdeep.org/hub/oauth_callback'
c.MyOAuthenticator.client_id = '7959f7faeee887a00c71'
c.MyOAuthenticator.client_secret = 'Client Secret'
c.Authenticator.whitelist = {'akmoore7','danielrychel' }
c.Authenticator.admin_users = {'Akmoore7','danielrychel'}

I'm not sure what is going on at the moment, I made sure the client id was inputted correctly. There are no errors just this log statement:
302 GET /hub/oauth_login?next= → https://github.com/login/oauth/authorize?redirect_uri=https%3A%2F%2Fjupyter2.uiuc-bdeep.org%2Fhub%2Foauth_callback&client_id=&response_type=code&state=eyJuZXh0X3VybCI6ICIiLCAic3RhdGVfaWQiOiAiZTdjNGU1YTkzZGU0NDViMGE4ZWU0NzY3ODY1Y2I1YmUifQ%3D%3D (@::ffff:141.142.60.194) 1.29ms

Also here is the oAuth application page, I dont think there is a problem there, but I would more than happy to be wrong: screen shot 2018-06-07 at 11 11 24 am

@betatim
Copy link
Member

betatim commented Jun 7, 2018

Could you explain again what exactly the problem is? From your subject it sounds you end up on a 404 page (on GitHub or on the hub?) but from your text all you say is that the hub redicrects you to a github.com page which is exactly what should happen.

@Akmoore7
Copy link
Author

Akmoore7 commented Jun 7, 2018

It redirects to a github page but it gave me this:
screen shot 2018-06-07 at 1 20 27 pm

@Akmoore7
Copy link
Author

Akmoore7 commented Jun 7, 2018

We actually figured out the issue, we had to add the client id and secret client id as well as the auth callback url in the env file. Then echoing the client id got me through to authorization.

@sblack4
Copy link

sblack4 commented Nov 14, 2018

For anyone else having this problem be wary of what authenticator you are using. The MyOAuthenticator is given as an example, not as an actual authenticator. for GitHub replace it with GitHubOAuthenticator

c.MyOAuthenticator.oauth_callback_url = 'https://jupyter2.uiuc-bdeep.org/hub/oauth_callback'
c.MyOAuthenticator.client_id = '7959f7faeee887a00c71'
c.MyOAuthenticator.client_secret = 'Client Secret'
c.Authenticator.whitelist = {'akmoore7','danielrychel' }
c.Authenticator.admin_users = {'Akmoore7','danielrychel'}

should be

c.GitHubOAuthenticator.oauth_callback_url = 'https://jupyter2.uiuc-bdeep.org/hub/oauth_callback'
c.GitHubOAuthenticator.client_id = '7959f7faeee887a00c71'
c.GitHubOAuthenticator.client_secret = 'Client Secret'
c.Authenticator.whitelist = {'akmoore7','danielrychel' }
c.Authenticator.admin_users = {'Akmoore7','danielrychel'}

@orionjeong
Copy link

Oh I made the same mistake. Some other examples give the correct information about the configuration, but github is missing. I think this should be added.

@ldnelso2
Copy link

ldnelso2 commented Apr 6, 2019

We actually figured out the issue, we had to add the client id and secret client id as well as the auth callback url in the env file. Then echoing the client id got me through to authorization.

Hi AKmoore7 - can you elaborate on this approach? I tried it but not working for me.

@liliarizona
Copy link

liliarizona commented Oct 13, 2019

We actually figured out the issue, we had to add the client id and secret client id as well as the auth callback url in the env file. Then echoing the client id got me through to authorization.

Hi AKmoore7 - can you elaborate on this approach? I tried it but not working for me.

I had the same issue, ended up fixing by (clientid, clientiSecret and callbackUrl were what's missing)

auth:
  type: github
  github:
    clientId: "xxx"
    clientSecret: "xxxx"
    callbackUrl: "xxxx"
    orgWhitelist:
      - "xxxx"
  scopes:
    - "read:user"

@iranika
Copy link

iranika commented Oct 29, 2019

I made a mistake :(
Added clientID, clientSecret, and callback to env file. But, Did not add to docekr-compose.yml

services:
  jupyterhub:
    build: jupyterhub
    image: jupyterhub_img
    container_name: jupyterhub
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - jupyterhub_data:/srv/jupyterhub
    environment:
      - DOCKER_JUPYTER_CONTAINER=jupyterlab_img
      - DOCKER_NETWORK_NAME=${COMPOSE_PROJECT_NAME}_default
      - OAUTH_CALLBACK_URL  //add
      - OAUTH_CLIENT_ID     //add
      - OAUTH_CLIENT_SECRET //add
      - HUB_IP=jupyterhub
      - HOST

@manics
Copy link
Member

manics commented Oct 13, 2020

I'm closing this as it's quite old and it's a support issue. If you're still having problems please post on the Jupyter Community Forum. Thanks!

@manics manics closed this as completed Oct 13, 2020
@Vinuram123
Copy link

I am not using the clientId, below parameters I am passing
const authorizationEndpoint = 'https://github.com/login/oauth/authorize';
const redirectUri = 'https://www.google.com/';
const scope = 'public_repo'; // Define required scopes
const responseType = 'code';
const state = this.generateRandomString(16);
I am getting the 404 page issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants