darkhz / invidtui

A TUI based Invidious client
MIT License
191 stars 6 forks source link

Invidtui refuses to accept tokens from webbrowser -- always "invalid token" #31

Closed emk2203 closed 8 months ago

emk2203 commented 9 months ago

When I try to copy over tokens from a web browser instance of Invidious where I am logged in, I always get the error message of "invalid token" and cannot proceed.

I tried both offered ways, the token manager page and the authorize token approach, and tried with all presented base64 tokens, with or without quotes, and with or without the 'v1:' in front of them when taken from token manager.

darkhz commented 8 months ago

Can you provide the name of the instance you are logging into? Sometimes an instance may not accept logging into it. In my case, I have tried with the instance invidious.fdn.fr, and both pasting session tokens and SIDs are working.

emk2203 commented 8 months ago

I used the same instance you did, invidious.fdn.fr When I open the token manager in the browser, I can see my token, which I select from the first letter to the end (equal sign) and then copy-and-paste with ctrl-shift-v into the console running invidtui after opening the menu with alt-M and then Tab to reach the Dashboard.

I am running invidtui via SSH, but there was no difference when running a local invidtui -- failed the same way.

Otherwise, invidtui works as it should. What could be wrong? The whole procedure is so simple that I don't see where an user error could have occurred.

What is your setup? I am using KDE on Arch Linux and log in via SSH, but a Kubuntu session (24.04 development) running a local invidtui fails the same way.

darkhz commented 8 months ago

Ah no, you must copy the entire JSON text presented on the screen, not just the session key itself. A session token comprises of a session key, authorization scopes and the signature. Are you sure you copied it correctly?

emk2203 commented 8 months ago

Which JSON text? This is my token manager page: Screenshot 2023-12-22 at 16-24-17 Tokenverwalter - Invidious

darkhz commented 8 months ago

Oh, I assumed you were going through the session token approach (i.e getting the token from https://invidious.fdn.fr/authorize_token, the second step mentioned in the authorization instructions on the dashboard).

You are trying to do the SID method (the first step mentioned in the authorization instructions on the dashboard). I have tried it right now, and I can now confirm that I am getting the same error. I will look into this.

emk2203 commented 8 months ago

I can confirm that I  can log in via the SID method after selecting the full JSON. So there's at least a working method now. Thanks for you efforts!

I leave this open since the SID method is cleaner and preferrable; hopefully, you find a fix. The session token method generates a new token. I do not know how the browser version and the invidtui version of invidious get synced with two different tokens.

darkhz commented 8 months ago

This has now been fixed in the current release. Do test with your token again.

emk2203 commented 8 months ago

It works. I needed to force invidtui to the invidious.fdn.fr instance, since it selects a different default instance now, but then it works.

Thanks!

Completely different question:

Is there already an example or advice for using invidtui via ssh/tmux to play vids/audio on a remote system? This would be my main future use case.

darkhz commented 8 months ago

Could you elaborate more on the use case you mentioned? The standard approach would be to install invidtui on your remote instance, ssh into the same remote instance and launch it. I haven't tried it in tmux, but I have done a few tests in GNU screen.

emk2203 commented 8 months ago

The use case would be a PC attached to an AV system with good TV and speakers and then to control it with a laptop from the couch.

tmux or screen shouldn't make much of a difference, I just prefer tmux.

The details are: How do I get audio and video to play on the remote system when logged in via ssh? I know that you can play video on X with DISPLAY=:0 mpv, for example. I do this now with my videos. Would I just need to run DISPLAY=:0 invidtui? Or do I need to use the DISPLAY=:0 mpv in the settings as well? Also, Wayland compatibility? This is something I need to find out as well, since everybody wants to migrate to Wayland, and I am tempted to give it a try.

When I run mpv via ssh on a wayland system, I can get the display on the remote screen by default. When I do this with invidtui, I only get a media fetcher error.

darkhz commented 8 months ago

invidtui runs on the console, it shouldn't be affected by the DISPLAY variable, since it is not a GUI. You could do DISPLAY=:0 <your-terminal-emulator and run invidtui from there.