问题描述
我是 google api 的新手.为 youtube 频道创建项目.我已经为项目创建了 api 并生成了 api 密钥.在项目上启用 Youtube api.我到处都在获取 OAUTH 授权的代码示例,但找不到任何用于使用 api 密钥授权的视频或 Java 代码示例.你能帮我重定向到适当的链接吗?
I am new to google apis. Creating project for youtube channel. I have created api and generated api key for the project. Enabled Youtube apis on the project. Everywhere I am getting code samples of OAUTH authorization, but not able to find any video or Java code samples for working with api Key authorization. Can you please help in redirecting me to appropriate link.
还想知道这两种方法之间是否有任何功能差异?
Also want to find out is there any feature difference between both methods?
推荐答案
如果你看看 Github 上的 Youtube Java 示例代码,可以看到 search
示例 正在使用 api 密钥 :
If you look at Youtube Java sample code on Github, you can see that the search
example is using api key :
YouTube.Search.List search = youtube.search().list("id,snippet");
String apiKey = properties.getProperty("youtube.apikey");
search.setKey(apiKey);
search.setQ(queryTerm);
这篇文章和这篇文章 与您关于 Oauth 与 API 密钥的问题相关
This post and this post are relevant to your question about Oauth vs API key
这篇关于Java 示例代码示例 youtube 数据 api v3 和授权方法作为 api 密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!