Skip to content

Youtube Cookies and oAuth

Fafa edited this page Nov 18, 2024 · 1 revision

Background

YouTube has limited OAuth login to TV clients. The effect is that, after linking YouTube to our app via Device Code, attempts to fetch web content will return HTTP 400 Bad Request errors. See, for example, LuanRT/YouTube.js#803 and yt-dlp/yt-dlp#11462.

To access account-specific content, users can still pass cookies from the web browser. A cookie is a string value that keeps track of the user's YouTube session in the browser.

Obtaining the Cookie

(Firefox was used for illustration, but you should be able to do it on other modern desktop browsers too):

  • In a browser, sign into YouTube (or YouTube Music, doesn't matter), then hit F12 to bring up the Developer Tools.
  • Choose the Network tab.
  • Select XHR filter.
  • Enter 'browse' in the Filter box.

image

  • Now scroll down the YouTube web page until an entry starting with 'browse' appears. Select it.
  • Scroll down in the Headers tab until you see Cookie under Request Headers.
  • Right-click on the value of Cookie and select Copy Value.
  • The cookie has been placed in your clipboard and can be passed to the app. It will remain valid until you sign out or YouTube expires it. Do not reveal the cookie to anyone!

386714535-c6f50ad9-abbf-4a45-8ecd-93f94b8ec145


Written originally by patrickkfkan/Volumio-YouTube.js

Clone this wiki locally