Skip to content

I cant access to JN with token when I use firefox. #3301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Huzo opened this issue Feb 3, 2018 · 28 comments
Open

I cant access to JN with token when I use firefox. #3301

Huzo opened this issue Feb 3, 2018 · 28 comments

Comments

@Huzo
Copy link

Huzo commented Feb 3, 2018

Hello,
So my default browser is firefox. When I start jupyter notebook I get the usual respond and a link such as: Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=7c014a1c5217f33143de0a891f0623f49afc4513761e728c. However when I paste this code to firefox, I get redirected to http://localhost:8888/tree no matter what. And that requires Password and Token (which does not work when I still paste the token). However if I paste my link to Chrome, it works fine and I dont even get asked authentication. I use firefox for everything so it is a bit annoying facing this issue. Any thoughts on this?

Thanks!

@takluyver
Copy link
Member

Do you have any unusual config in Firefox, such as blocking cookies?

@Huzo
Copy link
Author

Huzo commented Feb 3, 2018

Umm, do you know which particular preference names I should check under about:config?

@takluyver
Copy link
Member

I don't know, sorry. But the defaults should be fine, so unless you know that you've configured it to ignore cookies or something, it's probably not that.

What about browser extensions?

@Huzo
Copy link
Author

Huzo commented Feb 5, 2018

Every configuration is in default. I only have AdBlock as an extension but jupyter notebook used to work in Firefox with that extension installed.

@Huzo
Copy link
Author

Huzo commented Feb 5, 2018

I have fixed the problem by editing the jupyer notebook config file:

c.NotebookApp.token = ''
c.NotebookApp.password = ''

@takluyver
Copy link
Member

That's essentially disabling all security, which we don't recommend. You may want to try setting an explicit password by running jupyter notebook password at the command line.

@mfdooom
Copy link
Contributor

mfdooom commented Feb 5, 2018

Ran into a similar situation using firefox a couple of days ago. In addition to running jupyter notebook password, I had to clear some cookies on my browser.

@wl2776
Copy link

wl2776 commented May 8, 2018

Looks like I've got similar issue.

Firefox opens notebook, but after some time writes "Autosave failed!" and displays orange plate with the word "Forbidden" on saving attempts.

@takluyver
Copy link
Member

takluyver commented May 8, 2018 via email

@shaljam
Copy link

shaljam commented May 31, 2018

Mine used to work great but now tends to forget the token.

@takluyver
Copy link
Member

What version of the notebook do you have (jupyter notebook --version)? We fixed a bug relating to that recently.

@shaljam
Copy link

shaljam commented Jun 1, 2018

@takluyver I'm using 5.4.1.

@takluyver
Copy link
Member

Try upgrading to 5.5.0

@shaljam
Copy link

shaljam commented Jun 5, 2018

@takluyver Upgrading fixed my problem.

@marscher
Copy link

marscher commented Sep 2, 2018

It seems like the token passed via the URL is being altered by some middle layer. See this log for demonstration:

[I 10:48:42.128 NotebookApp] The Jupyter Notebook is running at:
[I 10:48:42.129 NotebookApp] http://localhost:8888/?token=1c9b13fc28608e7bd2b7bb2d9b491838080a47c58af4b17f
....
[I 10:48:42.412 NotebookApp] Accepting one-time-token-authenticated connection from 127.0.0.1
[I 10:48:46.459 NotebookApp] 302 GET /tree?token=f5faa7ce47aaf66aca1b6ccc283afe5754c9efcbf5fe65d0 (127.0.0.1) 1.16ms

If one copy/pasted the generated URL it works as expected, so something is fiddling around with the token before passing it to the browser. As observed this only affects Firefox (only tested on Linux). The observed behaviour is still present in notebook-5.5.0, but I suspect that Firefox or the layer below it is the culprit as other browsers handle the URL correctly.

@takluyver
Copy link
Member

When Jupyter opens the browser for you, it uses a second token which is valid for only one use. This is deliberate, because the command line arguments you launch a process with are visible to other users on the system, so someone could copy the token from the command line arguments and access your server.

@marscher
Copy link

marscher commented Sep 2, 2018

Ok, this makes sense. But xdg-open is a fairly common approach of delegating to the standard browser. Are there any changes we can have the one-time tokens for this use-case?

@marscher
Copy link

marscher commented Sep 2, 2018

It is actually weird, that the token has already been used before the real browser is invoked, because xdg-open should not make any connection.

@takluyver
Copy link
Member

I'm not quite sure what you mean. We don't use xdg-open, we use Python's webbrowser module, which tries to open the right browser on any platform.

The token that's printed in the terminal output ...is running at... is the regular, multi-use token. The single use token is only used for opening the browser.

@marscher
Copy link

marscher commented Sep 3, 2018 via email

@SHIVAJIGANGA
Copy link

Hello,
So my default browser is firefox. When I start jupyter notebook I get the usual respond and a link such as: Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=7c014a1c5217f33143de0a891f0623f49afc4513761e728c. However when I paste this code to firefox, I get redirected to http://localhost:8888/tree no matter what. And that requires Password and Token (which does not work when I still paste the token). However if I paste my link to Chrome, it works fine and I dont even get asked authentication. I use firefox for everything so it is a bit annoying facing this issue. Any thoughts on this?

Thanks!

With the same link try it on Google chrome you can able to open jupyter note book

@takluyver
Copy link
Member

Have you disabled cookies (or installed some addon that blocks them) in Firefox? That behaviour sounds like what you'd see with cookies disabled.

@marscher
Copy link

The thing is that xdg-open already accesses the URL containing the one-time token, so the token is invalid upon the desired (any real browser) access. This is just an issue with xdg-open, not jupyter.

@takluyver
Copy link
Member

@marscher xdg-open is mostly a generic wrapper over desktop-specific open commands (like gio open for Gnome and kde-open for KDE). I don't think it accesses the URL itself. It's possible that your desktop does access it before passing it to the browser, though.

@marscher
Copy link

marscher commented Dec 3, 2018

@takluyver It does access it for whatever reason, I see it in the log file of the server. I'm on KDE Plasma (and konsole to launch jupyter).

@Wasim-Ahmad
Copy link

i installAnaconda Python 3.7 in win 7 but my jupyter nootnbook is opening in my browozer,
i tride too much but faild please hlep me .

@Goddard
Copy link

Goddard commented Mar 8, 2020

Having the same issue. I thought it was something else for awhile until I opened it in Chromium and discovered it was indeed firefox.

I had previously used Firefox and it worked fine. Not sure if it is my firefox settings conflicting with jupyter setting, but it is clearly something.

I do have firefox debugging enabled I believe which may be an issue here?

@jwhendy
Copy link

jwhendy commented Feb 14, 2025

Bueller? I just switched to Firefox and the same happens to me. Pasting in the url with the token led me to a page prompting me for the token, and pasting the token in the field blips the page, but does nothing. I'm on MacOS 14.7.1, FF 135.0 installed yesterday, no modifications other than enabling vertical sidebar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants