Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve my own private playlist through YouTube API?

Tags:

youtube-api

I'm trying to find a way to retrieve my own private playlists from YouTube, for display on my own personal website. So far, all the documentation appears to say that retrieving private user data (like private playlists) requires that your site's users go through an authentication process in order to provide their own authentication.

In my case, I don't wan't my users to authenticate, I want my site to authenticate to my own account every time it accesses the Youtube Data API, in order to retrieve my own private playlists.

Is that possible? I thought it might be doable if I could just save the authentication token for my own account, but apparently the token changes? And what's the most appropriate method by which I should obtain the initial authorization token for my own account?

like image 928
coredumperror Avatar asked Nov 04 '22 14:11

coredumperror


1 Answers

You can go through the OAuth 2 for Installed Applications flow once, and generate and save a refresh token. Your server-side code can then use the refresh token to get a valid access token whenever it needs to make an API call on your behalf. This could be completely hidden from the visitors of your website if you code it correctly.

like image 159
Jeff Posnick Avatar answered Nov 17 '22 04:11

Jeff Posnick