Skip to content

Instantly share code, notes, and snippets.

Created Mar 14, 2018
What would you like to do?
tried to inject Authorization header for each request, but couldn't.
// This way didn't work.
// Cause this custom.js or nbextensions files will be loaded after initializing JupyterNotebookApp.
// It means this code won't affect to it's initializing Ajax requests.
// Sending token on each XHRs too.
// Because Safari won't handle Cookie and localStorage
// on iframes.
// Jupyter Client expects it's cookie, so it will be forbidden
// Instead, sending "token" by manually on each XHRs.
// Retrieving token from data attribute
// Because Jupyter Notebook will delete ?token param automatically.
var token = document.querySelector('body').dataset.jupyterApiToken || '';
headers: {"Authorization": 'token ' + token}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment