[Feature Request]: Proxying videos through Invidious with HTTP Auth.
Guidelines
- [X] I have searched the issue tracker for open and closed issues that are similar to the feature request I want to file, without success.
- [X] I have searched the documentation for information that matches the description of the feature request I want to file, without success.
- [X] This issue contains only one feature request.
Problem Description
By default FreeTube does not support HTTP Auth to private Invidious instances.
What's happening when I try to use HTTP Auth: FreeTube displays an error:
TypeError:
Failed to execute 'fetch' on 'Window':
Request cannot be constructed from a URL that includes credentials:
https://*user*:*password*@*domain*/api/v1/videos/*VIDEO_ID*
Steps to reproduce:
- Go to settings -> General Settings -> Current Invidious Instance.
- Set an instance what's under a HTTP Auth (use scheme like so
https://<user>:<password>@<domain>). - Go to settings -> Player Settings -> Enable
Proxy Videos Through Invidious. - Play a random video.
Proposed Solution
Making FreeTube authenticate to the HTTP Auth-protected Invidious instance and proxying videos through it.
Alternatives Considered
None as long as Invidious wouldn't get another way for authentication to the instance.
Issue Labels
improvement to existing feature
Additional Information
No response
This is a bug, not a feature. I don't understand why is not marked as such.
@EchedelleLR It is most certainly not a bug. There is no code in FreeTube to handle authentication for Invidious. That code needs to be added to implement the feature.
The only way it would be considered a bug, is if there were code to handle the authentication that wasn't working, but as that code literally doesn't exist yet, there is no way this could be considered a bug.
As there are no public instances that require authentication, someone will need to provide an instance that requires authentication and credentials to log into it, for us to even have a chance at implementing and testing it.
Understood, will check into the code if I have time and see if it is something that could be easily implemented. It works with AJAX requests by default, so I was initially confused about that.
AJAX/XMLHTTPRequest is the outdated and deprecated way of making requests in a web browser, which from what you are saying handles that for you, as the API is old enough to be from a time when including credentials in URLs was still considered secure.
The modern way is using the fetch API, which is where the error message you are seeing is coming from. Including credentials in URLs is deprecated in web browsers, Chrome for example will remove them from the URL bar and send the request without them, you can read up more on it here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#access_using_credentials_in_the_url
So what you will probably have to do is parse the URL, extract the credentials, create the relevant HTTP header and then make the request without the credentials in the URL but with that header.
You'll also need to figure out how to handle it for the videos and audio streams and images.
Thx for the information, I was not aware of the deprecation. Will try to figure it out.