問題描述
我的任務的目標是創建一個控制臺腳本,該腳本會將我自己網站上最近上傳的視頻插入到我自己的 Youtube 頻道中.我想使用服務器到服務器的身份驗證,但 YoutubeApi 現在不支持這種身份驗證方式.
The goal of my task is to create a console script, which will insert recently uploaded videos on my own site to my own Youtube channel. I want to use server-to-server authentication but YoutubeApi does not support this way of authentication now.
所以我的問題是:如何在沒有用戶幫助的情況下使用帶有控制臺腳本的 oauth2 身份驗證將視頻上傳到 youtube 頻道?如果不使用已棄用的 ClientLogin 身份驗證協議,有什么方法可以做到這一點嗎?
So my question is: How could I upload video to youtube channel, using oauth2 authentication with console script without any help of a user? Is there any way to do this without using deprecated ClientLogin authentication protocol?
推薦答案
是的,這部分解釋了如何:https://developers.google.com/youtube/v3/guides/moving_to_oauth#standalone
Yes this segment explains how to: https://developers.google.com/youtube/v3/guides/moving_to_oauth#standalone
基本上,您通過一次并從那里保存令牌.
Basically, you go through once and save the token from there.
如果您甚至想跳過那一次,您可以在 OAuth2 Playground 中獲取刷新令牌使用受尊重的范圍并將其直接插入到您的代碼中,并帶有客戶端密碼和 ID.這樣您的腳本就不需要網絡瀏覽器了.
If you even want to skip that one time as well, you can get a refresh token in OAuth2 Playground with respected scopes and plug it in directly in your code, with client secret and id. That way your script won't need a web browser.
這是逐步解釋此工作流程的視頻.
這篇關于使用 YoutubeApi v3 和 ouath2 在沒有用戶身份驗證的情況下將視頻上傳到我的 Youtube 頻道的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!