jupyterlab-github icon indicating copy to clipboard operation
jupyterlab-github copied to clipboard

add access_token to useProxy check

Open djeeg opened this issue 5 years ago • 2 comments

djeeg avatar Jun 02 '20 09:06 djeeg

Thanks @djeeg, is there an issue you are trying to fix here? This request (just checking for the proxy) shouldn't need authenticated access.

ian-r-rose avatar Jun 02 '20 19:06 ian-r-rose

oh right, the details seems to have gone missing.

quick summary of the setup:

  • jupyter hub on kube
  • connecting to gh enterprise instance
  • using user personal token
  • each user stores accessToken in extension config

if i burn this config into the notebook config py:

  • allow_client_side_access_token = True
  • api_url = internal github api
  • token = "ReplaceMe" https://github.com/jupyterlab/jupyterlab-github/blob/master/jupyterlab_github/init.py#L23-L39

and set extension config per user to be:

  • accessToken = user's personal access token

on call to _apiRequest

  • first a test on _useProxy is executed
  • _useProxy without an access_token throws an error
  • because server side there is no token to query the GH enterprise API
  • which means the requestUrl gets set to DEFAULT_GITHUB_API_URL https://github.com/jupyterlab/jupyterlab-github/blob/master/src/contents.ts#L547

an alternative way to solve this, could be to have a separate service-side route just for the proxy test, that was a no-op and just returned "ok" or something

djeeg avatar Jun 02 '20 19:06 djeeg