403 : Forbidden '_xsrf' argument missing from POST in Jupyterhub

352 Views Asked by At

I have a jupyterhub in docker, after installing nativeauthenticator and configuring jupyterhub_config.py with the following:

import os, nativeauthenticator, pwd,subprocess c.JupyterHub.authenticator_class = 'nativeauthenticator.NativeAuthenticator'

c.JupyterHub.template_paths = [f"{os.path.dirname(nativeauthenticator.file)}/templates/"]

c.Authenticator.admin_users = {'test'}

def pre_spawn_hook(spawner):

username = spawner.user.name

try:

    pwd.getpwnam(username)

except KeyError:

    subprocess.check_call(['useradd', '-ms', '/bin/bash', username])

c.Spawner.pre_spawn_hook = pre_spawn_hook

When creating or accessing with my user I get the following error

enter image description here

This error does not appear, I do not use the configuration

in the docker logs this appears 2023-05-03 17:55:41 [W 2023-05-03 21:55:41.281 JupyterHub log:191] 403 POST /hub/login?next=%2Fhub%2F (@::ffff:172.17.0.1) 4.89ms 2023-05-03 17:55:52 [I 2023-05-03 21:55:52.143 JupyterHub log:191] 302 GET /hub/ -> /hub/login?next=%2Fhub%2F (@::ffff:172.17.0.1) 2.40ms 2023-05-03 17:55:52 [I 2023-05-03 21:55:52.370 JupyterHub log:191] 200 GET /hub/login?next=%2Fhub%2F (@::ffff:172.17.0.1) 23.51ms 2023-05-03 17:55:54 [I 2023-05-03 21:55:54.035 JupyterHub log:191] 200 GET /hub/signup (@::ffff:172.17.0.1) 7.85ms 2023-05-03 17:56:00 [W 2023-05-03 21:56:00.813 JupyterHub web:1852] 403 POST /hub/signup (::ffff:172.17.0.1): '_xsrf' argument missing from POST 2023-05-03 17:56:00 [W 2023-05-03 21:56:00.821 JupyterHub log:191] 403 POST /hub/signup (@::ffff:172.17.0.1) 9.31ms

this configuration of jupyterhub is without occupying conda

I have tried changing the configuration but it does not work out for me, what I hope is to be able to use nativeauthentication to be able to use its functions

0

There are 0 best solutions below