api key - Android - youtube api r52 - "access not configured" -


i building simple test android app, trying data particular video. have taken sha1 fingerprint of debug keystore , created google api key (and package name). have activated youtube api service it.

this code:

youtube youtube = new youtube.builder(new nethttptransport(), new gsonfactory(), new httprequestinitializer() {     public void initialize(httprequest request) throws ioexception {} }).setapplicationname("myapp").build();  try {     youtube.videos.list listvideosrequest = youtube.videos().list("snippet,contentdetails");     listvideosrequest.setid("a3pdxmyof5u");     listvideosrequest.setkey(googleapikey.debug_google_api_key);     videolistresponse youtuberesponse = listvideosrequest.execute();      list<video> youtubevideos = youtuberesponse.getitems();      return youtubevideos;  } catch (ioexception e) {     log.e("myapp", e.getlocalizedmessage());     return null; } 

so, exception: 403, access not configured.

i running out of ideas, wrong. have used youtube api android yet api key?

update:

i debugged google libraries in order find, actual request looks like, sent google. this:

https://www.googleapis.com/youtube/v3/videos?id=a3pdxmyof5u&key=[my-debug-google-api-key]&part=snippet,contentdetails 

with these headers set:

accept-encoding: gzip user-agent: myapp google-http-java-client/1.15.0-rc (gzip) 

i don't see wrong there.

ok, after lot of reading found this google doc :

you must send authorization token every insert, update, , delete request. must send authorization token request retrieves authenticated user's private data.

in addition, api methods retrieving resources may support parameters require authorization or may contain additional metadata when requests authorized. example, request retrieve user's uploaded videos may contain private videos if request authorized specific user.

so conclusion simple - should use api key reading non-private data while videos may private. in case i've tried load channels anonymously - , works when requesting channel_id. when i've requested contentdetails (which contains link uploads) - i've got 403 error.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -