Giving scopes to users using jupyterlab token


I’m developing a jupyterlab extension and I need to give the token in jupyterlab the list:groups and list:users scopes, so that I can have access to the /api/groups endpoint. I’m getting the token from PageConfig.getToken()

I’m trying to update the scopes from the but apparently the token does’t get the scopes.

This is what I tried (and a few more things like setting groups)

c.JupyterHub.load_roles = [
        "name": "server",
        "scopes": ["list:groups", "list:users"],
        "default": True

and I check the scopes using:

curl -X GET \
     -H "Authorization: token $API_TOKEN" \


PageConfig.getToken() doesn’t retrieve the server token (that token is for internal requests originating in the server, not client requests to the server). PageConfig.getToken() returns the user’s oauth token, which is governed by c.Spawner.oauth_client_allowed_scopes.

1 Like