-
Notifications
You must be signed in to change notification settings - Fork 24
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
✨ Support Authentication #11
Comments
Hi @Loli-Killer, thanks for raising this issue! I was aware that it was possible to make authenticated requests using cookies in this way, however as it requires such a manual action by the user, I haven't included the functionality in the codebase. I'd really love to get OAuth working in some way, and I believe the community has been able to make some headway on this, so it's something I've been meaning to look into further. I'll keep this issue open, and hopefully will get a chance to explore the issue of authentication more soon 🙂 |
Getting oauth to work is relatively easy If you can read Golang this might help you out: |
@BRUHItsABunny Awesome! Thanks for providing that link, your implementation looks incredibly helpful. I've also found the following resource which looks like it might come in handy: I'll see if I can get some sort of a POC script for OAuth working using the resources provided in this issue |
Here's a quick POC script I've whipped together using import httpx
import pprint
client = httpx.Client()
CLIENT_ID = "861556708454-d6dlm3lh05idd8npek18k6be8ba3oc68.apps.googleusercontent.com"
CLIENT_SECRET = "SboVhoG9s0rNafixCSGGKXAT"
device_data = client.post(
"https://oauth2.googleapis.com/device/code",
data=dict(
client_id=CLIENT_ID,
scope="https://www.googleapis.com/auth/youtube",
),
).json()
device_code = device_data["device_code"]
print('== YouTube TV OAuth ==')
print(" 1. Visit:", device_data["verification_url"])
print(" 2. Enter code:", device_data["user_code"])
print()
input("Once done, press enter to request a token...")
token_data = client.post(
"https://oauth2.googleapis.com/token",
data=dict(
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
device_code=device_code,
grant_type="urn:ietf:params:oauth:grant-type:device_code",
),
).json()
pprint.pprint(token_data) I'll keep fiddling and will see if I can get any further |
Oh yea I remember seeing that a while ago as well. For that reason I use a dedicated Google account for the innertube automation I do but other than that it was worth it to me given auth tokens are only valid for a couple hours at a time. |
Just stumbled upon |
A couple of potentially handy links for this: |
What is the status of this? |
No further updates to report on this unfortunately, beyond the investigations in this issue. At some point I plan to implement the YouTube TV OAuth flow into |
not sure how this helps. this assumes you already have the
I am the author of that code, the current implementation is here: https://github.com/1268/media/blob/v1.6.4/youtube/token.go
FYI this code is based on the Google Services Framework 4.4, which is at least ten years old at this point. since version 5, URL like this is used instead: |
My current stance on authentication is that I'd prefer to avoid using a master token and am not a big fan of relying on browser cookies. OAuth is the preferred approach, and so the YouTube TV OAuth flow is looking like the best way forward, at least for now |
LOL WTF I just found another one for YouTube TV ([email protected]):
and:
|
@Loli-Killer Thanks for the step by step guide on how to create the headers for authentication |
Not sure if you already knew about it or not but from my testing you can do authenticated requests by using cookies. (Not sure how long will this last before needing to repeat the process again).
Steps to do
Preserve log
.set_registration
in the network search bar.SID
,HSID
,SSID
,APISID
andSAPISID
. You can delete the rest values or just leave them.SAPISIDHASH
by insertingSAPISID
value obatained from above into the function below.Notes
Reason why incognito is required is because for some reason the
SID
,HSID
andSSID
cookies aren't included in the request headers and instead it relies onx-goog-authuser
header value if you are already logged in. Clearing cache doesn't seem to include it either.I'm not really good at actually implementing stuffs so would be grateful if you could add the feature into the existing code.
The text was updated successfully, but these errors were encountered: