Hi everyone,
I am using JupyterHub 4 with the PAM authenticator and I would like to create users using the REST API, i.e. set a username and a password.
The following Python code works so far:
import requests
user_data = {'usernames': ['newusername'],
'admin': False,
}
response = requests.post(
'https://jupyterurl.com/hub/api/users',
headers={'Authorization': f'token 0bxxxxxxxxxxxxxxxxxxxxxxxdg'},
json=user_data
)
if response.status_code == 201:
print('It worked.')
else:
print('It failed.')
However, the user is created without setting a password. I checked the Jupyter REST API Documentation but couldn’t find anything related to the password.
The same applies when not using the API: If I, as an admin user, create a new user in the JupyterLab web interface, I don’t see any option to set the password.
How can I set the password?
Thanks a lot!
Peter