1

I am trying to use jupyterhub using token-based which is in Iframe. I had tried using postman by sending token as header it worked. But in browser

    $.ajax({ 
   type : "GET", 

 
   url : "http://jupiter.****.com/hub/login", 

   beforeSend: function(xhr){xhr.setRequestHeader('Authorization', 'token *****');
},
   success : function(result) { 

   }, 
   error : function(result) { 

   } 
 }); 

It gives me a Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ***. (Reason: CORS request did not succeed)

I had configured jupyterhub_config.py

c.JupyterHub.tornado_settings = {'headers': {'Content-Security-Policy': "frame-ancestors * 'self' " ,'Access-Control-Allow-Origin': '*','Access-Control-Allow-Methods':'*','Access-Control-Allow-Headers':'*','Access-Control-Allow-Credentials':'true'}}

c.Spawner.args = [f'--NotebookApp.allow_origin=*']

Any pointers/advice on how to implement this would be greatly appreciated!

0 Answers0