Answer the question
In order to leave comments, you need to log in
How to login to Google API OAuth2 from PHP console script?
Here is what the documentation suggests to do (all scripts start with the same authorization strings):
https://developers.google.com/youtube/v3/code_samp...
That is, CLIENT_ID and CLIENT_SECRET are taken,
Sent to https://accounts.google .com/o/oauth2/auth
A page appears on which you enter your login, password, select a subaccount if you have several pages of Google+ or Youtube channels.
The response is returned in the GET parameters of the script specified in the RedirectUri
. And I need a console script to do all this by cron without a browser and a web server.
That is, the script must log in, select the desired subaccount and all that needs to be done.
How to do it?
PS If you select non-UI (cron,cli) when creating keys for Youtube API, then the following message is displayed:
User data cannot be accessed from a platform without a UI because it requires user interaction for sign-in.
So you need to look for exactly some kind of option with OAuth. Examples in Python, for example, also require authorization in the browser, but 1 time, then they create a JSON file and then work with it without re-authorization
Answer the question
In order to leave comments, you need to log in
Save cookies and give cookies to the server - the only browser emulation. well, curl
I did something similar for VK.
Look at the idea and do something similar.
https://github.com/miraage/photomover/blob/master/...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question