I'm coding a music website that allows the user to create YouTube lists.
My first try has been with JS:
https://developers.google.com/youtube/v3/code_samples/javascript
The process implies an initial authorization, as you can see in this piece of HTML:
<div id="login-container" class="pre-auth">
This application requires access to your YouTube account. Please <a href="#" id="login-link">authorize</a> to continue.
</div>
Once you click on the link, a modal like this displays itself:
So you have to choose an account of your own -that moreover must be included in my GCP profile- to create the list in the YouTube channel related to that account.
But that's not the way I want my website to work: I want all of the users to create all of their lists in my YouTube channel. And only in mine.
So I need that any request the API receives from my website is authorized via the Gmail account related to my YouTube channel exclusively. Moreover, that way the authorization process would become invisible to the user, which it's an advantage. I want them to create their lists by just clicking a single button in my website.
I've been suggested to do all of this server-side -PHP in my case- using a service account, but reading the library docs I've found this:
https://github.com/googleapis/google-api-php-client#authentication-with-service-accounts
Some APIs (such as the YouTube Data API) do not support service accounts.
So... Do I have any other option to automate the authorization process?
from Accessing YouTube Data API without user intervention
No comments:
Post a Comment