How to pass access_token from Auth0 to the user's pod?

I have found the solution. Here is what I made :

hub:
  extraConfig:
    oauth.py: |
      from oauthenticator.auth0 import Auth0OAuthenticator
      from tornado import gen
      class CustomAuth0OAuthenticator(Auth0OAuthenticator):
        async def pre_spawn_start(self, user, spawner):
          spawner.log.debug('BEGIN pre_spawn_start')
          auth_state = await user.get_auth_state()
          spawner.environment['ACCESS_TOKEN'] = auth_state['access_token']
          spawner.environment['ID_TOKEN'] = auth_state['id_token']
          spawner.log.debug('END pre_spawn_start')
1 Like