문제

is it possible to retrieve a public youtube playlist with the google-api-objectivec-client without asking the user to login in order to perform the OAuth 2.0 authentication?

I'm working on an app which should retrieve a playlist from youtube and play related videos, but I cannot and don't want to ask the user to login.

In the examples of google-api-objectivec-client (https://code.google.com/p/google-api-objectivec-client/source/browse/#svn%2Ftrunk%2FExamples%2FYouTubeSample) I'm not able to achieve it without OAuth 2.0 authentication.

Thanks, DAN

도움이 되었습니까?

해결책

Yes, you don't need OAuth2 login for that. You can simply do it by setting your API key instead.

It's a playlistItems->list request.

Here's demonstration in api explorer: https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list?part=snippet&playlistId=PLjFEz-E0UPUxw3lFpnfV1dDA7OE7YIFRj&_h=2&

Instead of setting the authorizer of the service to OAuth2 login like in

youtubeservice.authorizer = [GTMOAuth2ViewControllerTouch authForGoogleFromKeychain.....

set it's API key to your API key from cloud console in Public API access.

youtubeService.APIKey = xxxxxx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top