Thursday 15 April 2010

Getting a 403 code making unauthenticated calls to v3 youtube data api -



Getting a 403 code making unauthenticated calls to v3 youtube data api -

the google api project app contains simple android key 2 applications allowed. 1 com.examples.youtubeapidemo, other app. if take com.examples.youtubeapidemo in , out of key fails expected. other app returns response: 11-06 08:06:52.321 32579-528/com.wfs.android.youtubesearchtest e/com.wfs.android.youtubesearchtest﹕ 403 forbidden { "code" : 403, "errors" : [ { "domain" : "usagelimits", "message" : "access not configured. please utilize google developers console activate api project.", "reason" : "accessnotconfigured" } ], "message" : "access not configured. please utilize google developers console activate api project." }

my code this: [in async task]

{ youtube.builder builder = new youtube.builder( new nethttptransport(), new jacksonfactory(), new httprequestinitializer() { @override public void initialize(httprequest request) throws ioexception { } }) .setapplicationname((string.valueof(r.string.app_name))); homecoming builder.build(); }

and this:

{ ... youtube youtube = createyoutubeservice();

youtube.search.list search = null; seek { search = youtube.search().list("id,snippet"); } grab (ioexception e) { log.e(tag, e.getmessage()); homecoming null; } search.setkey(developerkey.developer_key); search.setq(q[0]); search.settype("video"); search.setfields("items(id/kind,id/videoid,snippet/title,snippet/thumbnails/default/url)"); search.setmaxresults(number_of_videos_returned); searchlistresponse searchlistresponse = null; seek { searchlistresponse = search.execute(); }

the exception thrown on searchlistresponse = search.execute();

i have tested key, there may have missed in code?

i tested browser key , com.examples.youtubeapidemo works either one. app still has same issue; posts using browser key instead did not work me.

thanks!

i found problem after much pain. steps solve may help in future. final thing did utilize browser key instead of android key. had tried before [several times] , gotten same error. [maybe not propagate changes right away]

the helpful thing me api explorer here: [https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list]

this took browser key

once changed key in code got results back.

as said tried browser key many times before this. did prior step above delete entire google api console [all projects ] , start over...[drastic]. don't know solved problem, point is: a browser key used in api explorer should homecoming results; key used in project should homecoming results; , if not maybe problem 1 or more of projects in api console. not study problems keys in experience. i did not turn on 'extra' apis in console work. posts utilize browser key right.

i started new debug key store don't expect mattered. takeaway 'use explorer'.

android-youtube-api

No comments:

Post a Comment