<p>I have implemented a simple website where user can log in/register via some existing service (e.g Google). After log in a user can manage his Jupyter notebook - open/delete. Basically a user has an account where he can access his notebook. The website and Jupyter notebook are containerized by Docker and organized by Kubernetes.</p>
<p>Now the problem is to bind authentication of a user via Google to access Jupyter notebook without requiring Jupyter notebook token/password from user. It is a problem because URL at which container with Jupyter notebook is running is known and accessible by anyone (so disabling password is not an option).</p>
<p>I tried to search for a way to make the container running at certain URL link accessible only by redirect from other website (in my case it would be user account page) but I haven't found a way. Also I was thinking about writing the Jupyter notebook token on the home screen after deploying notebook for every user with option to set the password for notebook but it seems to me very annoying to ask user for Google password and straight after password/token to notebook.</p>
<p>So I would like to know if there is an efficient way to bind authentication via Google with access to Juypter notebook with requiring only authentication via Google.</p>

<p>I found a working solution to my problem.</p>
<p>I generated my own token with python library secrets. This token I passed as environment variable to container with Jupyter notebook (JUPYTER_TOKEN). So the Jupyter notebook uses this token as it's default. Now I can redirect user from website to Jupyter notebook using manually generated token.</p>
<p>Simply:</p>
<ol>
<li>Generate token</li>
<li>Deploy Jupyter notebook container with token as env variable</li>
<li>Redirect user to https://{JUPYTER}.com/?token={TOKEN}</li>
</ol>
<p>Where JUPYTER is a place where jupyter notebook container is running and TOKEN is manually generated token. This way user is redirected without requiring of manually typing password. Also no one from outside of internet without knowledge of this token can't get access to Jupyter notebook.</p>
