Jupyterhub API Forbidden (403) Code

Hello!

I have setup my k8s cluster and installed succesfully jupyterhub using Helm.

I’m trying to utilize the API, but I’m getting “Forbidden” status code.
The procedure that I’m following is to login to jupyterhub, then go to “Token” menu and “Request new API token”. Then, I’m taking the generated token and use it as Authorization header to Postman.

It looks like your Authorization header value is missing the word token before the actual API token value. In other words, change this:

Authorization: YOUR_API_TOKEN

To this:

Authorization: token YOUR_API_TOKEN

See also: Using JupyterHub’s REST API — JupyterHub 2.1.1 documentation

1 Like

I tried that too but my issue was that I was using the “dummy” authenticator class. Thus, there was not any admin user defined hence I couldn’t use the API. Upon configuring my .yml accordingly it works by using the authorization header as you mentioned.

hub:
  config:
    JupyterHub:
      admin_access: false
    Authenticator:
      admin_users:
        - admin

Then, by logging in as “admin” user, I generated the token from the /hub/token and I’m able to make API calls.