Is Jupyter support Cookies/Session?

I’m not sure this topic is created in correctly category. if not. please accept my apology.

i’m newbie, i would like to know is Jupyter notebook is act like a browser? where it possible to store cookies/session and pass to my custom python library.for authentication checking?

Thanks.

Hi! Could you give us more information about what you want to do? For example, are you trying to extend Jupyter(Lab) with a new extension, are you trying to connect to Jupyter using it’s API, something else?

We have build some compute data sdk using python. As you know, if we published this library to public library registry everyone can use this sdk. Our usecases, is to allow authenticated user to consume it.

I would like to know is Jupyter can behave like browser, which can store cookies and session. when i connect to authentication service e.g. outh2, it auth token, jwt token can be pass to python sdk, n our compute data sdk can auth it and restrict it whoever dont have permit to use it.

By “Jupyter” do you mean a notebook in Jupyter? If so the notebook is just a way to code in whatever programming language you’ve chosen. For example if you’re using Python there are several libraries that support making HTTP requests with cookies and persistent sessions- this is independent of the fact you’re using Jupyter.

If you mean something else more explanation would be helpful, or even better a link to some example code illustrating what you want to achieve.

some prototype:

from flask import Flask, session, request
from keycloak import KeycloakOpenID
from customAPI import CustomAPI #Assume

keycloak_open_id = KeycloakOpenID(server_url=“http://localhost:8080/auth/”,
client_id=“Centrum”,
realm_name=“myrealm”,
client_secret_key=“c_k”)

url = keycloak_open_id.auth_url(‘http://localhost:5555/auth’)

after get the authencated

call customAPI.getData → API open for public

call customerAPI.camputeData → API open for authenciated user (can the auth session, cookies from the keycloak above, pass to this)