Java Sample Code examples youtube data api v3 and authorization method as api key

自闭症网瘾萝莉.ら 提交于 2019-12-11 01:45:59

问题


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?


回答1:


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);

This post and this post are relevant to your question about Oauth vs API key



来源:https://stackoverflow.com/questions/45063916/java-sample-code-examples-youtube-data-api-v3-and-authorization-method-as-api-ke

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!