Access user defined api by jupyter-server-proxy through curl

I have a jupyterhub running with jupyter-server-proxy, therefore I can start a flask application as a user and access the API by jupyter proxy.

It is all goes well with configuring an oauth2 authentication, authenticating my log in by using browser store. The cookies are saved and then I can access the API endpoint by using browser.

However, I want to access the API by using command line curl with giving the access_token from the authentication session. I put the access_token in the HEADER Beaer and it is not working (as expected). I check the documentation JupyterHub and OAuth — JupyterHub 2.2.0.dev documentation If I understand it correctly the access_token to the external oauth provider (in my case github) is stored in the jupyterhub and it is not able to be used for user access the resource from jupyterhub.

Is there a way to only use this external oauth provider access_token to access the API endpoint just as using the browser with cookies?

The example of my case is I have a flask app running in port 5000 by the user (the first time it goes to github for authentication), the app has a API /helloworld which return 200 and print hello world. To access this endpoint I can use https://<example.com>/hub/user-redirect/proxy/5000/helloworld . Only the first time it asks for authentication, then I can access the API. But I can only do this with browser where the cookie is stored. Can I use the external oauth provider access_token to access this API?

Best,
Jason