Zero-to-jupyterhub-k8s: How to define api tokens in config.yaml

Created on 23 Apr 2019  路  3Comments  路  Source: jupyterhub/zero-to-jupyterhub-k8s

Hi,

Having read through the documentation about authentication and tokens, I am a bit confused as to how I can define a hard coded api_token in my config.yaml file. I think that I need to edit hub.services.proxy.apiTokens or something but I have not been able to successfully create a token.

I have found examples however these haven't worked for me. Perhaps I am configuring them incorrectly?

Some pointers would be appreciated!

Jonathan

Most helpful comment

I have found examples however these haven't worked for me. Perhaps I am configuring them incorrectly?

When you say "these haven't worked" what were you doing? This is an example of how the CI tests use the token:

All 3 comments

This is my current configuration:

proxy:
  secretToken: "30fb1f57ba1ea9977be102cabdcc4b4fbb7a3ae1c52d2673861c9ab4b8934b7a"

singleuser:
  image:
    name: nanowire/datascience-notebook
    tag: 0.0.2

hub:
  image:
    name: nanowire/jupyterhub-nanowireauthenticator
    tag: 0.1
  services:
    nanowireserviceaccount:
      admin: True
      apiTokens:
        - { '4844c8ac5612700667248831d8e811e190efbe47a000f879d4d238fcad498514': 'nanowireserviceaccount' }

auth:
  type: custom
  admin:
    access: true
    users:
      - nanowireserviceaccount
  custom:
    className: "nanowireauthenticator.NanowireAuthenticator"

We are using a custom authenticator however I don't think that should affect api tokens as I have been able to create working tokens through the web interface.

I have found examples however these haven't worked for me. Perhaps I am configuring them incorrectly?

When you say "these haven't worked" what were you doing? This is an example of how the CI tests use the token:

Perfect, yes it just looks like I hadn't set the variables correctly. It's all working now!

Was this page helpful?
0 / 5 - 0 ratings