How to use API KEY with YouTube in angularjs and list videos in a playlist?


#1

I want to list a bunch of videos from YouTube in my mobile app using angularjs. Preferrably I’d like to list all videos of a user/channels specific playlist.

I’ve gotten the API KEY from Google Developer Console but I don’t understand how and where to use it. In this documentation they only go over the oauth method. https://developers.google.com/youtube/v3/code_samples/javascript#authorizing_requests I tried using the example code straight up from that documentation only to get a message saying I have to authenticate first.

I’d really appreciate some help into this. How do authenticate using the api key and secondly how to make the request to get the videos in a playlist. Thanks!


#2

Examples are a great way to learn.


#3

Hi @mhartington do I use the browser key or Android key?


#4

I believe you would use the browser key, since it’s technically a webview


#5

Ok thanks, should the domain be ‘localhost’?


#6

For demo and testing purposed yes, you can use localhost


#7

Thanks very much you have helped a lot. How about when the app has been deployed in release mode? What domain will I use?

Thanks again Mike!


#8

You would probably want to have a registered domain for that.