Jupyter Hub API Token in Jupyter Lab Extension

I am writing a Jupyterlab extension and I need to get a JupyterHub API token for the user logged in so I can make some calls to JupyterHub API. I am using PageConfig.Token() function to get the API token but it returns an empty string instead of the Token.

Thanks

There’s a related discussion in Get current user info in Jupyterlab extension